Forums » .NET » ASP.NET »

GridView Selected Index changed Event


Posted Date: 03 Aug 2007      Posted By:: kumarg     Member Level: Silver    Member Rank: 0     Points: 2   Responses: 8



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



Responses

#141671    Author: Koteswara Rao      Member Level: Gold      Member Rank: 449     Date: 03/Aug/2007   Rating: 2 out of 52 out of 5     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();
}


 
#141672    Author: mallikarjun      Member Level: Silver      Member Rank: 0     Date: 03/Aug/2007   Rating: 2 out of 52 out of 5     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;

}


 
#141675    Author: kumarg      Member Level: Silver      Member Rank: 0     Date: 03/Aug/2007   Rating: 2 out of 52 out of 5     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





 
#141677    Author: mallikarjun      Member Level: Silver      Member Rank: 0     Date: 03/Aug/2007   Rating: 2 out of 52 out of 5     Points: 2

can u please send ur code and the form

 
#141678    Author: kumarg      Member Level: Silver      Member Rank: 0     Date: 03/Aug/2007   Rating: 2 out of 52 out of 5     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


 
#141681    Author: kumarg      Member Level: Silver      Member Rank: 0     Date: 03/Aug/2007   Rating: 2 out of 52 out of 5     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>


 
#141682    Author: mallikarjun      Member Level: Silver      Member Rank: 0     Date: 03/Aug/2007   Rating: 2 out of 52 out of 5     Points: 2

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


 
#141683    Author: mallikarjun      Member Level: Silver      Member Rank: 0     Date: 03/Aug/2007   Rating: 2 out of 52 out of 5     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


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : what is change resquest?(interview question )
Previous : Hep Rregarding Function
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages

Subscribe to Subscribers
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John

Online Members

Rameshkumar
More...
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India