Hi Every One
i have one grid view in first column of grid view i have one check box
my question is how to check the check box is checked or unchecked at least one should checked when user click the accept or decline button which is out side the gird i mean the accept or decline out side the grid i would like to do this at client side i mean through java script
thanks in advance
Loading

naura paxRank #2,843 · 502 reputationPosted Oct 26, 2009, 2:46 AM EDT
<script type="text/javascript">
function SelectAll(id) {
var frm = document.forms[0];
for (i=0;i if (frm.elements[i].type == "checkbox") {
if(document.getElementById(id).checked==true)
{
//your code
}
}
mohdazeemuddin ahmed125 reputationPosted Oct 26, 2009, 9:40 PM EDT
naura paxRank #2,843 · 502 reputationPosted Oct 26, 2009, 9:55 PM EDT
that was a sample code you can directly write
if(..getelementbyid(id).Checked==true) in your javascript function where you want to do some conditional checking.
id refers to checkbox control as seen web page when you do right click on page and select "View Source".
mohdazeemuddin ahmed125 reputationPosted Oct 26, 2009, 10:38 PM EDT
protected void Tes(object sender, EventArgs e) { foreach (GridViewRow row in gvProject.Rows) { CheckBox checkedselected = (CheckBox)row.FindControl("chkSelect"); if (checkedselected.Checked == true) Response.Write("hello"); } }if i checked the check box then also its given me value false can you tell me were i am doing mistake
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Oct 27, 2009, 12:21 AM EDT
As I understand, the reson is when you check the check box, it doent post back to the server.
Set checkbox.AutoPostBack = true;
So this will automatically post the state back to the server when it is clicked.
If my answer helps you, please accept it. It will help me a lot.
mohdazeemuddin ahmed125 reputationPosted Oct 27, 2009, 12:29 AM EDT