You must Sign In to post a response.

GridView Selected Index changed Event

Grid View's Selected Index Changed event does not fire in my form. can anyone tell me what are the possibilities?


Comments

Author: Koteswara Rao03 Aug 2007 Member Level: Gold   Points : 2

IN 2005 dotnet
in U R grid press f4 and then SEE THE properties there
is a symbal yellow color click on that select the grid
view oage index changing
write this code

protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{ gv.PageIndex = e.NewPageIndex;
FillData();
}

Author: mallikarjun03 Aug 2007 Member Level: Silver   Points : 2

// Selecting row

void myGridView_SelectedIndexChanged(object sender, EventArgs e)
{

// This will contain the selectedValue of the row

string selectedCategory = myGridView.SelectedRow.Cells[1].Text;

}

Author: kumarg03 Aug 2007 Member Level: Silver   Points : 2

hi MalikaArjun,
i have given the way you have mentioned, and also set a break point. but control doesn't go there, the event doesn't fire.... what to do

Author: mallikarjun03 Aug 2007 Member Level: Silver   Points : 2

can u please send ur code and the form

Author: kumarg03 Aug 2007 Member Level: Silver   Points : 2

hi MalikaArjun,
i have given the way you have mentioned, and also set a break point. but control doesn't go there, the event doesn't fire.... what to do

Author: kumarg03 Aug 2007 Member Level: Silver   Points : 2

I have given the code part(not the whole code)


protected void gvwIdlRate_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = gvwIdlRate.SelectedRow;
int iRownum = gvwIdlRate.SelectedIndex;
}
protected void gvwIdlRate_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
GridViewRow row = gvwIdlRate.SelectedRow;
}





<asp:TemplateField HeaderText = "Add Row">
<HeaderStyle CssClass ="gViewHeader"/>
<asp:GridView ID="gvwIdlRate" AllowSorting="True" runat="server" CellSpacing="1" CellPadding="5" SelectedIndex="0" BorderWidth="0px" AutoGenerateColumns="False" Width = "100%" OnRowDeleting="gvwIdlRate_RowDeleting" OnRowCreated="gvwIdlRate_RowCreated" OnSelectedIndexChanged="gvwIdlRate_SelectedIndexChanged" OnSelectedIndexChanging="gvwIdlRate_SelectedIndexChanging">
<HeaderStyle CssClass="gViewHeader" />
<Columns > <ItemTemplate>
<asp:ImageButton ID="btnAddNextRow" ImageUrl="../../Images/Mplus.gif" runat = "server" CommandName ="Select" OnClick = "btnAddRow_Click" />
<asp:Label ID="lblRowCnt" runat="server" Visible="False"></asp:Label>

</ItemTemplate>
<ItemStyle CssClass="gViewCntd" Width = "25px" />
</asp:TemplateField>

Author: mallikarjun03 Aug 2007 Member Level: Silver   Points : 2

http://www.codersource.net/asp_net_grid_view_whidbey.aspx
go trough this this will helpful to u

Author: mallikarjun03 Aug 2007 Member Level: Silver   Points : 2

protected void gvwIdlRate_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
GridViewRow row = gvwIdlRate.SelectedRow;
Response.Redirect("Default.aspx");

}
Default.aspx meens where you have to redirect when u click the select


Sign In to post your comments