"pelegk1" <pe*****@discussions.microsoft.comwrote in message
news:DE**********************************@microsof t.com...
1)how do i add a button to a grid view (in a column of its own)?
<asp:GridView ID="MyGridView" runat="server" AutoGenerateColumns="False"
OnRowDataBound="MyGridView_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:Button ID="MyButton" runat="server">
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
2)how do i change the text that appeaers on the button RowCreated Event ?
protected void MyGridView_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((Button)e.Row.FindControl("MyButton")).Text = "Hello";
}
}
3)with which event can i change the text on the button when the button is
pressed and how?
protected void MyGridView_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((Button)e.Row.FindControl("MyButton")).Attributes .Add("onclick",
"this.value='Clicked';");
}
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net