m-jansen
asked on
How to send GridViewRowEventArgs to OnCheckedChanged
How to send GridViewRowEventArgs to OnCheckedChanged? It's not possible to just replace EventArgs with GridViewRowEventArgs.
protected void Velg_CheckedChanged(object sender, EventArgs e)
{
Label2.Text = "asdasdasd";
}
protected void Velg_CheckedChanged(object
{
Label2.Text = "asdasdasd";
}
It's not possible to replace these types
ASKER
how to deal with it?
what are you trying to do?
ASKER
>what are you trying to do?
when a checkbox is clicked another c# method should be run
when a checkbox is clicked another c# method should be run
ASKER
I have actuallt almost figured out how to deal with it like this.
protected void GridView1_RowDataBound(obj ect sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow )
{
CheckBox Velg = (CheckBox)e.Row.FindContro l("Velg");
Velg.Attributes.Add("oncli ck", ""+ list.Add(32) +"");
}
}
but the value 32 does not add to my list when I click the select button
protected void GridView1_RowDataBound(obj
{
if (e.Row.RowType == DataControlRowType.DataRow
{
CheckBox Velg = (CheckBox)e.Row.FindContro
Velg.Attributes.Add("oncli
}
}
but the value 32 does not add to my list when I click the select button
ASKER
ops I mean the checkbox
list.Add(32) is a codebehind(server side) what will not work with "onclick" event (client side).
ASKER
If I can't use onclick and not use OnCheckedChanged. What to do then? There have to be a someway to handle this?
you could use OnCheckedChanged, I don't see why not.
ASKER
Good. How would you suggest to it?
ASKER
I need to send a GridViewRowEventArgs to the OnCheckedChanged method. How to do it? It sounds difficult to me.
..
CheckBox Velg = (CheckBox)e.Row.FindContro l("Velg");
Velg.CheckedChanged +=new EventHandler(Velg_CheckedC hanged);
....
private void Velg_CheckedChanged(object sender, EventArgs e)
{
...
//do your stuff
..
}
CheckBox Velg = (CheckBox)e.Row.FindContro
Velg.CheckedChanged +=new EventHandler(Velg_CheckedC
....
private void Velg_CheckedChanged(object
{
...
//do your stuff
..
}
ASKER
protected void GridView1_RowDataBound(obj ect sender, GridViewRowEventArgs e) {
CheckBox Velg = (CheckBox)e.Row.FindContro l("Velg");
Velg.CheckedChanged += new EventHandler(Velg_CheckedC hanged);
}
protected void Velg_CheckedChanged(object sender, EventArgs e) {
string s = e.Row.Cells[0].Text;
}
This code does not work.
CheckBox Velg = (CheckBox)e.Row.FindContro
Velg.CheckedChanged += new EventHandler(Velg_CheckedC
}
protected void Velg_CheckedChanged(object
string s = e.Row.Cells[0].Text;
}
This code does not work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for good help