Click here to Skip to main content
15,743,429 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
for (int itemcount = 0; itemcount < Rpt_Company.Items.Count; itemcount++)
{
    CheckBox chkbox = ((CheckBox)Rpt_Company.Items[itemcount].FindControl("chkbox"));
    if (chkbox != null && chkbox.Checked == true)
    {

      //  memberno += chkbox.Text;
        //memberno += (chkbox.Text + "<br />");
        Literal lbl = (Literal)Rpt_Company.Items[itemcount].FindControl("chkbox");
  
         string lblid;
         lblid = lbl.Text;

      
    }
}


selected checkbox value to be received in a string or label...help me
Posted
Updated 4-May-12 2:25am
v2
Comments
VJ Reddy 4-May-12 8:25am    
Edit: pre tag for C# code added.

1 solution

Declare a string in ur class

string chkVal;


set checkbox_CheckChanged event for the checkbox put something like following

C#
private void checkbox1_CheckChanged(object sender,EventArgs e)
{
if(checkbox1.Checked)
{
chkVal=checkbox1.Text;
}
else
{
chkVal="";
}
}



Best of luck......
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900