javascript - Show hide div containing gridview between postback -


hi new using jquery , having doubt how implement scenario :-

i have div element should hidden on page load, whenever click button going postback , populate grid present inside div , div should become visible after postback.

<asp:button id="btngetgrid" runat="server" onclick="btngetgrid_click">  <div id="mydiv" runat="server"> <asp:gridview runat="server" id="grddisplay"/> </div> 

on .cs file

protected void btngetgrid_click() {  code populate grid } 

if anyways going full page postback can use visible property of div this:-

<div id="mydiv" runat="server" visible="false">     <asp:gridview runat="server" id="grddisplay"/> </div> 

then, in code behind if data data source set visible property true:-

protected void btngetgrid_click(object sender,eventargs e) {     //code populate grid     if(records count > 0)     {         mydiv.visible = true;     }  } 

if doing partial postback using ajax, can jquery otherwise in full postback case won't work.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -