Hi,
I have two checkboxes in each row of a grid. One for Modify and another one
for View. If I click Modify the View should get automatically checked and
should be disabled. Earlier I did this in server side and thing was working
fine. But when the user clicks the last row in the grid and make the modify
in that row to be checked the focus goes to the top of the page because of
page submission. so I did that using Javascript. Upto the operations in the
page i.e. upto the checking and disabling of view check box the process was
going very smooth. Afterwards when I try to insert the values of checkbox
into the database for Modify i.e the base checkbox(boased on this only the
View checkbox receives its status) the value was correct, but for View
checkbox the value it inserts in the database was false,eventhough it is
checked. Previously i was using web control. Now I am using HTMLControl
because of some unknown problems. Now if this gets corrected the work will
move smoothly. Can anyone help me in this regard.
Following is the code.
function CheckChangedEvent(ctrl1,ctrl2)
{
var ctrlID1=document.getElementById(ctrl1);
var ctrlID2=document.getElementById(ctrl2);
ctrlID2.checked = true;
if(ctrlID1.checked == true)
{
ctrlID2.checked = true;
ctrlID2.disabled = true;
}
else if(ctrlID1.checked == false)
{
ctrlID2.checked = false;
ctrlID2.disabled = false;
}
}
and in server side am getting the value as follows.
ViewState["id_Modify_chk"] =
Convert.ToInt32(((HtmlInputCheckBox)dg1.Cells[2].FindControl("_gridChkModify")).Checked);
ViewState["id_View_chk"] =
Convert.ToInt32(((HtmlInputCheckBox)dg1.Cells[3].FindControl("_gridChkView")).Checked);
int _modi_val = Convert.ToInt32(ViewState["id_Modify_chk"]);
int _view_val = Convert.ToInt32(ViewState["id_View_chk"]);
Thanks and Regards,
N.Ramakrishnan
|