We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to get Treeview checkboxes postback values ?

Hello,


I am currently trying to get the POST values of my checkboxes treeview.

I have set the enableviewstate to false for the treview and i would like to get the checkboxes values by Request.Form.Get.

I obtain something like that :
ctl08_I3_B = on
ctl08_I2_B = on
ctl09_I3_B = on
etc..

I success with setting an ID to the treeview (for example tv) by myTreeview.ID = "tv"

and then have tv_I3_B but how can I set an ID to each checkbox of the treeview.

I would like to define myself (and programmaticely) the ID of each checkboxes.
This would let me get the posted values with Request.Form.Get

Also, if I could set the "name" attribute of all chckboxes, I could get the checkboxes post values with the coma separation, all in the same posted value instead of many ctlXX_I0_B with on values..
It seems that the Treeview tool is not able to do so is it ?

Thank you very much

3 Replies

DY dymezac November 2, 2007 09:15 AM UTC

>Hello,


I am currently trying to get the POST values of my checkboxes treeview.

I have set the enableviewstate to false for the treview and i would like to get the checkboxes values by Request.Form.Get.

I obtain something like that :
ctl08_I3_B = on
ctl08_I2_B = on
ctl09_I3_B = on
etc..

I success with setting an ID to the treeview (for example tv) by myTreeview.ID = "tv"

and then have tv_I3_B but how can I set an ID to each checkbox of the treeview.

I would like to define myself (and programmaticely) the ID of each checkboxes.
This would let me get the posted values with Request.Form.Get

Also, if I could set the "name" attribute of all chckboxes, I could get the checkboxes post values with the coma separation, all in the same posted value instead of many ctlXX_I0_B with on values..
It seems that the Treeview tool is not able to do so is it ?

Thank you very much



DY dymezac November 2, 2007 09:16 AM UTC


>Hello,


I am currently trying to get the POST values of my checkboxes treeview.

I have set the enableviewstate to false for the treview and i would like to get the checkboxes values by Request.Form.Get.

I obtain something like that :
ctl08_I3_B = on
ctl08_I2_B = on
ctl09_I3_B = on
etc..

I success with setting an ID to the treeview (for example tv) by myTreeview.ID = "tv"

and then have tv_I3_B but how can I set an ID to each checkbox of the treeview.

I would like to define myself (and programmaticely) the ID of each checkboxes.
This would let me get the posted values with Request.Form.Get

Also, if I could set the "name" attribute of all chckboxes, I could get the checkboxes post values with the coma separation, all in the same posted value instead of many ctlXX_I0_B with on values..
It seems that the Treeview tool is not able to do so is it ?

Thank you very much



MW Melba Winshia Syncfusion Team November 6, 2007 01:39 PM UTC

Hi,

We regret for the delayed response.

1) To get the POST values of my checkboxes treeview.

If your intention is to get Treeview checkboxes postback values, it can be achieved by using the below code snippet both on client side and server side.

Client side:
-----------

function ClientSideCheckChanged(node)
{
var status = "Unchecked";

if (node.Checked)
{
status = "Checked";

}
document.getElementById("feedbackClientSideCheck").innerHTML = status + ": '" + node.Text + "'";


}

Server Side:
-----------


protected void TreeView1_NodeCheckChanged(object sender, Syncfusion.Web.UI.WebControls.Tools.TreeViewNodeEventArgs e)
{
if (e.Node.Checked == true)
feedbacklabelServerSideCheck.Text = "Checked: '" + e.Node.Text + "'";
else
feedbacklabelServerSideCheck.Text = "UnChecked: '" + e.Node.Text + "'";
}

Please refer the sample in the below link which illustrates the above:

http://websamples.syncfusion.com/samples/Tools.Web/5.2.0.25/69573/main.htm


2) would like to define myself (and programmaticely) the ID of each checkboxes.

It is not possible set ID for each checkboxes. Sorry for the inconvenience caused.

Please let me know if you have any other questions.

Thanks,
Melba

Loader.
Live Chat Icon For mobile
Up arrow icon