Home>

Assumption:data source control grdiview, no refresh updatepannel, friendship prompt updateprogress, paging dropdown list dropdownlist

Under normal circumstances:the gridview pagination has linkbutton or button, so if i want to updateprogress prompt, it is very simple, first hide the gridview, and then add an onclientclick to get it done!

In the dropdownlist's onchange event:

function selectchange () {
      if ($("select option"). is (":selected")) {
        $("#btn11"). click ();
      }
    }

redirect to:

<asp:dropdownlist runat="server" autopostback="true" onchange="return selectchange ();">
 </asp:dropdownlist>
function cleardata () {
      //$("#<%=_gvguest.clientid%>"). Empty ();
      $("#_ gvguest"). empty ();
      //$("#<%=lblmessage.clientid%>"). Hide ();
      $("#lblmessage"). hide ();
    }
<asp:linkbutton runat="server"<span>onclientclick="return cleardata ();"</span>
commandname="page" commandargument="first" enabled="&%;(#gridview) container.parent.parent) .pageindex!=0%>">First page</asp:linkbutton>

But the dropdownlist has no onclientclick event, what should I do?

Because it said that the button has onclientclick, we can think of using the button to convert it! !! !! !!

Solution:Put a hidden button on the page:

<asp:button runat="server" cssclass="btnpage" style="display:none;" onclick="btn11_click" onclientclick="return cleardata2 ();" />

Then assign the value of the drop-down box to a hidden field in the onclientclick event

function cleardata2 () {
      var hidddl=$("#_ gvguest_ddlneedpage"). val ();
      $("#hidneedpage"). attr ("value", hidddl);
      $("#_ gvguest"). empty ();
      $("#lblmessage"). hide ();
    }

Then set the pageindex of _gvguest to the value of the hidden field in the click event!

protected void btn11_click (object sender, eventargs e)
    {
      if (! string.isnullorempty (hidneedpage.value))
      {
        _gvguest.pageindex=convert.toint32 (hidneedpage.value);
        binddata ();
      }
    }
  • Previous Subview event response and method of obtaining subview in iOS development
  • Next C # structure characteristics example analysis