Click here to Skip to main content
15,885,780 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Actually in my radcomboboxe item template i am having the check box,linkbutton for link button i am binding the users if i check the check box of the particular user i should get the name of the user in combobox here my problem how many users i selected through checkbox it should display in combobox.below is my code

XML
<telerik:RadComboBox ID="rdPhysicianscmb" runat="server" Width="75%"
                                               DataSourceID="sdsAttachedUsers"  Filter="Contains" Font-Size="14pt"
                                               onitemdatabound="rdPhysicianscmb_ItemDataBound" LoadingMessage="Loading..." EmptyMessage="">
                                     <ItemTemplate>
                                           <asp:CheckBox ID="chk" runat="server" />
                                           <asp:LinkButton ID="lblphyname" runat="server"  CommandName="Selected"    ForeColor="#0489B5" Font-Size="11pt"
                                       CommandArgument='<%# Eval("AssignedTo") %>'  onclick="lblphyname_Click" Text='<%# Eval("UserID") %>' Font-Underline="false" Font-Overline="false">
                                        </asp:LinkButton>

                                               </ItemTemplate>
                                    </telerik:RadComboBox>
Posted
Updated 4-Jun-13 1:50am
v3
Comments
ntitish 31-May-13 3:14am    
is it possible to get the userid on combobox through java script if i check the check box of the user
Osman24 31-May-13 3:21am    
Yes you can but you must create a way to create combobox and others with your ids. If not you will not know the id of an component and you will not reach this pbject via javascript.
ntitish 31-May-13 5:30am    
Sir if possible can u code for me by seeing above code bec today is my last day to complete the task..

1 solution

you can add this

<asp:checkbox id="chk" runat="server" name="<% " checkbox"="" +="" #container.itemindex="" %&gt;"="" xmlns:asp="#unknown"> something like that as i remembered and others too. Add an onclick event for checkbox and in this function get the name of sender and it will be something like that checkbox0 and replace checkbox with label and use

document.getElementsByName("myInput")[0]

this code. Now you reached the label. You can get the userid.
 
Share this answer
 
Comments
ntitish 31-May-13 10:09am    
sir sorry to say ...i am not getting clearly ....
Osman24 31-May-13 11:14am    
Sorry It is my bad also sorry for bad english. Here is the thing when you bind checkbox items like CommandArgument='<%# Eval("AssignedTo") %>' you just get the value and embed into it. Container.ItemIndex means you get the index of item. So when you add name='<% "checkbox" + #Container.ItemIndex %>' it means in the first item the combobox's name attributes becomes checkbox0 and in the second it becomes checkbox1(If you add this into checkbox). When you add this to linkbutton and if you add this like name='<% "linkbutton" + #Container.ItemIndex %>'
the first item's linbutton's name attribute becomes linkbutton0.

So when you add onclick event to checkbox, on the javascript you can get name attribute of sender. For example if you click first checkbox, you will get name attribute as checkbox0. So by this way you will know, first checkbox clicked so you need the component whichs name attribute is linkbutton0.

To be able to handle this component you will use for example document.getElementsByName("linkbutton0")[0]. So this elements value is your userid.

Is everything ok?
ntitish 1-Jun-13 0:53am    
sir u r not getting my problem i want to call the javascript while closing the Radcombobox there is an event called OnClientDropDownClosed in radcombobox so there i want to call the javascript to collect the userid of the checked checkbox by separating with coma into radcombobox text..

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