passing data in c#
i have a gridview in that i have checkboxes if i tick on checkboxes those data should move to another page i want code for this in c#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
anusha kanthetiPosted Sep 17, 2008, 11:00 PM
ravi kumarPosted Sep 17, 2008, 3:11 AM
Hi Anusha,
I have code for getting displayesd in the controls when ever we select check boxes in grid. here is the code. Hope this will help you.
protected
void chkID_CheckChanged(object sender, EventArgs e){
//FormBinding.ResetControls(new AssignmentScheduleInfo().getFieldList(), tblControls, true); CheckBox chkBox = sender as CheckBox; GridViewRow row = (GridViewRow)chkBox.NamingContainer;
Boolean status = chkBox.Checked;ClearCheckBoxes();
if (status == true){
cmdAdd.Enabled =
false;cmdUpdate.Enabled =
true;txtActSdate.Enabled =
true;txtActEdate.Enabled =
true;txtDesc.Enabled =
true;txtSchSdate.Enabled =
false;txtSchEdate.Enabled =
false;cmbStatus.Enabled =
true;// **** Filling the controls with data when the checkbox in the grid is clicked ****//
try{
chkBox.Checked =
true;hdnId.Value = (chkBox.NamingContainer
as GridViewRow).RowIndex.ToString();Ass_id =
Convert.ToInt32(hdnId.Value); //classinfo.hdnAssSid = Convert.ToInt32 (gdvAssSch.Rows[id].Cells[1].ToString); //classinfo.hdnAssSid = Convert.ToInt32(gdvAssSch.Rows[id].Cells[1].Text);hdnTasID.Text = gdvAssSch.Rows[Ass_id].Cells[1].Text;
txtSchSdate.Text = gdvAssSch.Rows[Ass_id].Cells[2].Text;
txtSchEdate.Text = gdvAssSch.Rows[Ass_id].Cells[3].Text;
txtActSdate.Text = gdvAssSch.Rows[Ass_id].Cells[4].Text;
txtActEdate.Text = gdvAssSch.Rows[Ass_id].Cells[5].Text;
txtDesc.Text = gdvAssSch.Rows[Ass_id].Cells[6].Text;
cmbStatus.Text = gdvAssSch.Rows[Ass_id].Cells[7].Text;
}
catch (Exception ex){
}
}
else{
hdnId.Value =
string.Empty;chkBox.Checked =
false;gdvAssSch.Visible =
false;cmbBatchId.Enabled =
true;txtActSdate.Text =
"";txtActSdate.Enabled =
false;txtActEdate.Text=
"";txtActEdate.Enabled=
false;cmdAdd.Enabled =
true;cmdSave.Enabled =
false;cmdUpdate.Enabled =
false;}
}
if anything needed, feel free to contact me.
Rgds
Ravi