G
Guest
I have the following asp:checkbox as a row in my datagrid. and im trying to
write code on the onCheckedChanged event of it. The code im trying to write
is incorrect as im getting build errors. What im trying to do is populate a
label on my aspx page with the contents of the row in the database which I
have checked. When I uncheck the checkbox I want the label to be set to
blank so as it can be populated again when another checkbox in the datagrid
is ticked. The html for the checkbox is below along with the code-behind
page. Can someone tell me what i've done wrong and how I can fix this.
Thanks for any help anyone can give.
<asp:TemplateColumn HeaderImageUrl="../Images/Tick.gif">
<HeaderStyle HorizontalAlign="Center" Height="20px" Width="10px"
CssClass="dgHeader" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Width="10px"
VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>
<asp:CheckBox ID="chkSelection" Runat="server" AutoPostBack="True"
OnCheckedChanged="myFunction"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
public void myFunction(object sender, System.EventArgs e)
{
this.lbldatagridrow.Text = e.Item.Cells[0].Text;
}
Build Error: -
'System.EventArgs' does not contain a definition for 'Item'
write code on the onCheckedChanged event of it. The code im trying to write
is incorrect as im getting build errors. What im trying to do is populate a
label on my aspx page with the contents of the row in the database which I
have checked. When I uncheck the checkbox I want the label to be set to
blank so as it can be populated again when another checkbox in the datagrid
is ticked. The html for the checkbox is below along with the code-behind
page. Can someone tell me what i've done wrong and how I can fix this.
Thanks for any help anyone can give.
<asp:TemplateColumn HeaderImageUrl="../Images/Tick.gif">
<HeaderStyle HorizontalAlign="Center" Height="20px" Width="10px"
CssClass="dgHeader" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle HorizontalAlign="Center" Width="10px"
VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>
<asp:CheckBox ID="chkSelection" Runat="server" AutoPostBack="True"
OnCheckedChanged="myFunction"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
public void myFunction(object sender, System.EventArgs e)
{
this.lbldatagridrow.Text = e.Item.Cells[0].Text;
}
Build Error: -
'System.EventArgs' does not contain a definition for 'Item'