[英]Can we avoid postback in gridView…when user click a button in same?
I have a gridview ...in my dotnet 2.0 - web application. 我在dotnet 2.0-Web应用程序中有一个gridview。
gridview has 2 columns...first column is ID..and second is a "link button"..as shown below. gridview有2列...第一列是ID ..第二列是“链接按钮” ..如下所示。
On click of this link, I have to display a popup..and I'm using ajax ModalPopupExtender. 在单击此链接时,我必须显示一个弹出窗口。并且我正在使用ajax ModalPopupExtender。
I am able to see the popup. 我可以看到弹出窗口。
But the issue is...when I click on this link button the postback happens...and the gridview.datasource is NULL. 但是问题是...当我单击此链接按钮时发生回发...并且gridview.datasource为NULL。 So I have to fetch the data from database and bind the gridview again. 因此,我必须从数据库中获取数据并再次绑定gridview。
Please help me to find a way to avoid this. 请帮助我找到避免这种情况的方法。
<asp:GridView ID="AvailableGridView" >
<Columns>
<asp:BoundField ItemStyle-CssClass="ItemStyleCss" ItemStyle-HorizontalAlign="Center"
HeaderStyle-CssClass="GridHeaderRow" HeaderText="ID" DataField="ClaimCodeGroupIdText"
/>
<asp:TemplateField HeaderText="View" ShowHeader="False"> <ItemTemplate>
<asp:LinkButton CssClass="localNavigation" ID="ViewCCGLinkButton"
Text="View" CommandName="View" CommandArgument='<%# Eval("ClaimCodeGroupId") %>' runat="server"></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle CssClass="GridHeaderRow" />
</asp:TemplateField>
</Columns>
<asp:GridView />
You can set ajax toolkit modal popup to load client side and not cause a postback. 您可以设置ajax工具箱模式弹出窗口以加载客户端,而不引起回发。
But if you have to get data from the server side, i think you have following options 但是,如果您必须从服务器端获取数据,我认为您有以下选择
Pick your options according to ur need and requirement. 根据您的需求和要求选择您的选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.