CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 6/28/2006 12:16:36 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 18 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
oshoval
Asp.Net User
How to Simulate TreeView checkbox as radio button?6/28/2006 12:16:36 PM

0/0

Is There a way that TreeView checkboxes will act like Radio Buttons?
akjoshi
Asp.Net User
Re: How to Simulate TreeView checkbox as radio button?6/29/2006 6:57:02 AM

0/0

Hi,

I think what you want to do is to let user select only one checkbox at a time, if he checks other previous one should get unchecked automatically, if yes then you can do this by using following javascript code   -

function

client_OnTreeNodeChecked(event)

{

var TreeNode = event.srcElement || event.target ;

if (TreeNode.tagName == "INPUT" && TreeNode.type == "checkbox")

{

if(TreeNode.checked)

{

uncheckOthers(TreeNode.id);

}

 

}

}

function

uncheckOthers(id)

{

var elements = document.getElementsByTagName('input');

// loop through all input elements in form

for(var i = 0; i < elements.length; i++)

{

if(elements.item(i).type == "checkbox")

{

if(elements.item(i).id!=id)

{

elements.item(i).checked=

false;

}

}

}

}

Add client_OnTreeNodeChecked function to your treeviews onclick event

private

void Page_PreRender(object sender, EventArgs e)

{

TreeView1.Attributes.Add(

"OnClick", "client_OnTreeNodeChecked(event)");

}

Now each time user checks a checkbox other checkboxes will get unchecked.

Hope thats what you wanted...

 


Aj
2 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

Software engineering documentation - borland.public.delphi.language.delphi.win32 - Web Programming Newsgroups Software engineering documentation, > ROOT > NEWSGROUP > Borland Forums > borland. ... how to simulate treeview checkbox as radio button? master label change ...
TheMSsForum.com >> Asp >> How to create a DLL - The Microsoft Software ... How to simulate the test environment? I want to generate the button click event simultaneously. ... and i'm using TreeView control as links The links are on ...
How-To + css-html - SWiK Web PHP design technology How-To css-html. jQuery Treeview with MODx and Wayfinder ... structure where to place your form elements (input, radio, checkbox, button...
TheMSsForum.com >> Asp >> how to stop page processing on server - The ... Can I simulate this button clicking inside this JavaScript and how? ... DataRepeater with Radio Buttons Hi, Does anyone have a sample of a DataRepeater ...
CodeProject: ASP.NET TreeView Control & the Client's Browser. Free ... This article describes how to group radio-buttons when using them in DataGrid, ... How to simulate Node click. abhiace. 12:56 31 Jul '06 ...
ASP.net Web Controls [Archive] - HighTechTalks DotNet Forums Radio button List problem: How to find value of Radio button list's Selected ... How to simulate Back button?... ( 2 replies) CreateChildControls (1 replies) ...
>> Windows Forms >> Archive Page 47 16223: how to simulate something as dialogbox in c#. 16224: Find number from string ... 16266: TreeView Comtrol: Add buttons to nodes in TreeView control ...



 
All Times Are GMT