c# फ़िल्टर लागू करने के बाद सी#ग्रिडव्यू रिफ्रेश इंडेक्स



asp.net sorting (0)

नमस्कार वहाँ मेरे पास एक ग्रिडव्यू और कुछ टेक्स्ट बॉक्स हैं जो उपयोगकर्ता एक खोज बटन के माध्यम से ग्रिडव्यू को फ़िल्टर कर सकते हैं।

फ़िल्टर के लागू होने के बाद मुझे ग्रिडव्यू के भीतर चयन करें हाइपरलिंक को ताज़ा करने में परेशानी हो रही है

नीचे बटन कोड देखें

protected void PropSearch_Search_Click(object sender, EventArgs e)
    {

        bool Others = false;

        String Horizon_PropID = "";
        String Horizon_SiteID = "";
        String Zone = "";
        String PropName = "";
        String SiteName = "";
        String PostCode = "";
        String Town = "";


        String Where = "";
        String SqlWhere = "";

        Horizon_PropID = PropSearch_HorizonPropID.Text;
        Horizon_SiteID = PropSearch_HorizonSiteID.Text;
        Zone = PropSearch_Zone.Text;
        PropName = PropSearch_PropName.Text;
        SiteName = PropSearch_SiteName.Text;
        PostCode = PropSearch_PostCode.Text;
        Town = PropSearch_Town.Text;


        BindingSource BS = new BindingSource();
        BS.DataSource = GridView1.DataSource;
        BS.Filter = "";





        if (Horizon_PropID != "")
                {
                    Where = "Horizon_Property_ID like '%" + Horizon_PropID + "%' ";

            SqlWhere = "Horizon_Property_ID like %'" + Horizon_PropID + "'% ";

                    Others = true;
                }


        //////////////////////////////////////////////////////////////////////////////////////////////

        if (Horizon_SiteID != "" && Others == true)

        {
            Where = Where + " and Horizon_Site_Id like '%" + Horizon_SiteID + "%' ";

        }

        else if (Horizon_SiteID != "" && Others == false)

        {
            Where = "Horizon_Site_Id like '%" + Horizon_SiteID + "%' ";
            Others = true;
        }



        //////////////////////////////////////////////////////////////////////////////////////////////////////


        if (PropName != "" && Others == true)

        {
            Where = Where + " and Property_Name like '%" + PropName + "%' ";


        }

        else if (PropName != "" && Others == false)

        {
            Where = "Property_Name like '%" + PropName + "%' ";
            Others = true;
        }


        //////////////////////////////////////////////////////////////////////////////////////////////////////


        if (SiteName != "" && Others == true)

        {
            Where = Where + " and Site_Name like '%" + SiteName + "%' ";

        }

        else if (SiteName != "" && Others == false)

        {

            Where = "Site_Name like '%" + SiteName + "%' ";
            Others = true;
        }

        //////////////////////////////////////////////////////////////////////////////////////////////////////


        if (PostCode != "" && Others == true)

        {
            Where = Where + " and PostCode like '%" + PostCode + "%' ";


        }

        else if (PostCode != "" && Others == false)

        {
            Where = "PostCode like '%" + PostCode + "%' ";
            Others = true;

        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////

        if (Town != "" && Others == true)

        {
            Where = Where + " and Town like '%" + Town + "%' ";


        }

        else if (Town != "" && Others == false)

        {
            Where = "Town like '%" + Town + "%' ";
            Others = true;

        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////

        if (Zone == "All" && Others == false)

        {
            //Where = Where + " and Zone = " + "'"+Zone+"' ";
            Others = true;

        }

        else if (Zone != "All" && Others == false)

        {
            Where = " Zone = " + "'" + Zone + "' ";
            Others = true;
        }

        else if (Zone != "All" && Others == true)

        {
            Where = Where + " and Zone = " + "'" + Zone + "' ";

        }



        //txt_DS.Text = Where.ToString();

        BS.Filter = Where;

        Filtering = Where;


        GridView1.DataSource = BS.DataSource;   

        GridView1.DataBind();

    }

मैं चयन हाइपरलिंक के पीछे सूचकांक को कैसे रीफ़्रेश करूं

यहां तक ​​कि जब मैं एक कॉलम को सॉर्ट करता हूँ तो हाइपरलिंक का चयन सही आईडी की उम्मीद नहीं करता I

नीचे ग्रिडव्यू स्रोत कोड देखें।

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"  Height ="1px" Width ="300px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowDataBound="GridView1_RowDataBound" OnPageIndexChanging="GridView1_PageIndexChanging" OnSorting="GridView1_Sorting" AutoGenerateSelectButton="True" AllowPaging="true" AllowSorting="True" >
            <Columns>






                <asp:BoundField DataField="Horizon_Property_Id" ReadOnly="True" HeaderText="Horizon_Property_Id" SortExpression="Horizon_Property_Id" />
                <asp:BoundField DataField="Horizon_Site_Id" ReadOnly="True" HeaderText="Horizon_Site_Id"  SortExpression="Horizon_Site_Id" />
                <asp:BoundField DataField="Zone" HeaderText="Zone" ReadOnly="True" SortExpression="Zone" />
                <asp:BoundField DataField="Property_Name" HeaderText="Property_Name" ReadOnly="True"  SortExpression="Property_Name"    />
                <asp:BoundField DataField="Site_Name" HeaderText="Site_Name" ReadOnly="True" SortExpression="Site_Name" />
                <asp:BoundField DataField="Street" HeaderText="Street" ReadOnly="True"  SortExpression="Street"    />
                <asp:BoundField DataField="Town" HeaderText="Town" ReadOnly="True" SortExpression="Town" />
                <asp:BoundField DataField="PostCode" HeaderText="PostCode" ReadOnly="True" SortExpression="PostCode" />





            </Columns>
        </asp:GridView>

और भी नीचे मेरी GridView1_PageIndexChanging घटना

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {


        GridView1.PageIndex = e.NewPageIndex;
        DataBind();

    }

सादर

लूटना