本文介绍了onpageindexchanging和onselectedindexchanged事件未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
asp:GridView ID="grdPatient" runat="server" AllowPaging="True"
Width="100%" PageSize="20" CellPadding="0" ForeColor="#333333"
EmptyDataText="No records available!!!" BorderStyle="Solid" BorderWidth="1px"
BorderColor="#45ADD5" CssClass="mGrid"
PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
AutoGenerateColumns="False" onpageindexchanging="grdPatient_PageIndexChanging"
onselectedindexchanged="grdPatient_SelectedIndexChanged">
<AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
<Columns>
<asp:TemplateField ItemStyle-Width="5px" HeaderText="S.No." HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%# Container.DataItemIndex + 1 %><b />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Sno" HeaderText="Sno"
HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
Visible="false" >
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="Name" HeaderText="Patient Name" />
<asp:BoundField DataField="Mobile" HeaderText="Mobile No" />
<asp:BoundField DataField="IsConverted" HeaderText="Is Converted" />
<asp:TemplateField HeaderText="View Full Details"
HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="center"
ItemStyle-Width="5%" ControlStyle-Height="20px"
ControlStyle-Width="20px">
<ItemTemplate>
<asp:LinkButton ID="imgDel" runat="server" Visible="true" CommandName="Del" CommandArgument="<%# Container.DataItemIndex %>">
<asp:Image ID="imgDelImage" ImageUrl="~/Images/show.png" ToolTip="" runat="server" />
</asp:LinkButton>
</ItemTemplate>
<ControlStyle Height="20px" Width="20px"></ControlStyle>
<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Width="5%"></ItemStyle>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="pgr"></PagerStyle>
</asp:GridView>
推荐答案
private void Page_Load()
{
if (!IsPostBack)
{
BindYourGrid();
}
}
参考 - []
这篇关于onpageindexchanging和onselectedindexchanged事件未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!