-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: surajmsn
Message 1 in Discussion
Hi group,
i am Creating a Bound column and Template column for checkbox in DataGrid in
asp.net, i want to access the DataGrid cell value of the Boundcolumn in the CheckBox
event handler when the Checkbox is selected. i am getting the error: index outof
range for the Row of the selected checkbox
in the checkbox event handler. How can i access the cell value of boundcolumn in
the checkbox event handler?
i am including the code-snippet below;
Please Help!,
Thanx in advance.
*******************************************************************************
namespace MTR.Components
{ public class wfrmCheckBoxGrid : System.Web.UI.Page,ITemplate
{
private DataGrid DG = new DataGrid();
private void Page_Load(object sender, System.EventArgs e)
{ //'Create the DataGrid
CreateGrid();
}
private void CreateGrid()
{ //'Add the Data columns
BoundColumn datagridcol = new BoundColumn();
DG.Columns.Add(datagridcol); //'Add the Template Col. for CheckBox
TemplateColumn tempCol = new TemplateColumn();
wfrmCheckBoxGrid colTemp = new wfrmCheckBoxGrid();
tempCol.ItemTemplate = colTemp;
DG.Columns.Add(tempCol);
//'Bind the DataValues to the DataGrid
DG.DataBind();
} public void InstantiateIn(Control container)
{
CheckBox mycheckbox = new CheckBox(); mycheckbox.AutoPostBack=true;
mycheckbox.EnableViewState = true; container.Controls.Add(mycheckbox);
mycheckbox.CheckedChanged += new EventHandler(this.chkBoxEventHandler);
} public void chkBoxEventHandler(object sender, EventArgs e)
{
CheckBox senderChkBx = (CheckBox)sender;
// And here i want to Access the DataGrid Cells Value of First Column,
// taking Checkbox-index as selected value
}
}
}
***********************************************************************************************
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]