Is there is any way to redirect to different pages in gridview_SelectedIndexChanged method. Or can we have 2 SelectedIndexChanged events in one cs class for same gridview. I have placed linkbutton and one command field, which has to redirect to different
web forms. Is there is any other way to implement the same.
you can not have 2 selected index changed events, rather for your scenario you do not need that event at all. You have to bind the OnRowCommand, OnRowEditing etc events where you can pass the command name to identify the click.
sandhya33
Member
3 Points
25 Posts
gridview SelectedIndexChanged redirecting to different forms
Jan 31, 2013 10:41 AM|LINK
hi all,
Is there is any way to redirect to different pages in gridview_SelectedIndexChanged method. Or can we have 2 SelectedIndexChanged events in one cs class for same gridview. I have placed linkbutton and one command field, which has to redirect to different web forms. Is there is any other way to implement the same.
goel.ankit
Contributor
2531 Points
513 Posts
Re: gridview SelectedIndexChanged redirecting to different forms
Jan 31, 2013 10:49 AM|LINK
you can not have 2 selected index changed events, rather for your scenario you do not need that event at all. You have to bind the OnRowCommand, OnRowEditing etc events where you can pass the command name to identify the click.
http://www.codeproject.com/Questions/407859/Edit-update-and-delete-from-grid-view-in-asp-net
http://stackoverflow.com/questions/1647428/asp-net-gridview-commandfield-as-templatefield
Ankit
(Please select 'Mark as Answer' if my response has helped you.)
oned_gk
All-Star
36078 Points
7363 Posts
Re: gridview SelectedIndexChanged redirecting to different forms
Jan 31, 2013 10:50 AM|LINK
use hyperlink with target _blank
<asp:TemplateField> <ItemTemplate> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("id","detail.aspx"id={0}") %>' Target="_blank" Text="view"></asp:HyperLink> </ItemTemplate> </asp:TemplateField>Suwandi - Non Graduate Programmer