| | |
Working on Datagrid with Listboxes !!
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2005
Posts: 19
Reputation:
Solved Threads: 0
Hi All,
I have specific requirement in asp.net project.
I have datagrid, in that in have one dotnet list control which stores the items.And it is multiselect. Onclicking >> button i want to move selected items from dotnetListControl to HTML Select(listbox) control.
In DataGrid:
DotnetListBOX Control(i multiselect few items then)---> >>(Click on the button) ----> add to new listbox(Html Select)
I tried with ItemDataBound but still i could not able to get it.
(Problem: When Datagrid is rendered, i am not able to get unique id for HTML select control).
Kindly let me know if any other good idea ...
Thanks and with regards,
Madhusudhan
I have specific requirement in asp.net project.
I have datagrid, in that in have one dotnet list control which stores the items.And it is multiselect. Onclicking >> button i want to move selected items from dotnetListControl to HTML Select(listbox) control.
In DataGrid:
DotnetListBOX Control(i multiselect few items then)---> >>(Click on the button) ----> add to new listbox(Html Select)
I tried with ItemDataBound but still i could not able to get it.
(Problem: When Datagrid is rendered, i am not able to get unique id for HTML select control).
Kindly let me know if any other good idea ...
Thanks and with regards,
Madhusudhan
•
•
Join Date: Sep 2005
Posts: 8
Reputation:
Solved Threads: 0
Not sure if this is what you are attempting to do.
Scenerio
Datagrid has a 2 listbox controls. When clicking >> button, click event should move selected items from listbox1 to listbox2
Solution
Scenerio
Datagrid has a 2 listbox controls. When clicking >> button, click event should move selected items from listbox1 to listbox2
Solution
ASP.NET Syntax (Toggle Plain Text)
'Code within >> button click event For Each gridItem As DataGridItem In DataGrid1.Items Dim list1 As ListBox = CType(gridItem.FindControl("List1"), ListBox) Dim list2 As ListBox = CType(gridItem.FindControl("List2"), ListBox) For Each item As ListItem In list1.Items If item.Selected Then list2.Items.Add(item) End If Next Next
•
•
Join Date: Sep 2005
Posts: 19
Reputation:
Solved Threads: 0
Even >> button is in the same grid.
If there are 5 rows in a grid, then
listbox1 >> buttons Listbox2
listbox1 >> buttons Listbox2
listbox1 >> buttons Listbox2
listbox1 >> buttons Listbox2
listbox1 >> buttons Listbox2
will appear.The IDs for all these control after rendering is different like dgGrid_ctl2:listbox1
dgGrid_ctl3:listbox1 etc ...
Similarly for >> button and listbox 2.
Still i could not able to fix this error.
Kindly provide some more details.
Thanks and with regards,
Madhusudhan
If there are 5 rows in a grid, then
listbox1 >> buttons Listbox2
listbox1 >> buttons Listbox2
listbox1 >> buttons Listbox2
listbox1 >> buttons Listbox2
listbox1 >> buttons Listbox2
will appear.The IDs for all these control after rendering is different like dgGrid_ctl2:listbox1
dgGrid_ctl3:listbox1 etc ...
Similarly for >> button and listbox 2.
Still i could not able to fix this error.
Kindly provide some more details.
Thanks and with regards,
Madhusudhan
•
•
Join Date: Sep 2005
Posts: 8
Reputation:
Solved Threads: 0
[HTML]<!-- Code in ASPX DataGrid -->
<ItemTemplate>
<input type="button" value="Move" onclick="javascript
wapList('<%# (Container.ItemIndex + 1) %>');">
</ItemTemplate>[/HTML]
<ItemTemplate>
<input type="button" value="Move" onclick="javascript
wapList('<%# (Container.ItemIndex + 1) %>');"></ItemTemplate>[/HTML]
ASP.NET Syntax (Toggle Plain Text)
//Javascript Code: //function should take an input of the current index function SwapLists(idx) { var inpt = document.frmProdDetail.getElementsByTagName("input"); var list1, list2; for (var i = 0; i < inpt.length; i++) { if (inpt[i].id.match('ctl' + idx + '_MyAspxListBox1') != null) { list1 = inpt[i]; } else if (inpt[i].id.match('ctl' + idx + '_MyAspxListBox2') != null) { list2 = inpt[i]; } } //Write your javascript to transfer selected items from list1 to list2 }
![]() |
Similar Threads
- Working with datagrid (Visual Basic 4 / 5 / 6)
- To display an icon in a datagrid (VB.NET)
- Linking to E-mail through datagrid (ASP.NET)
- adding totals in listboxes (Visual Basic 4 / 5 / 6)
Other Threads in the ASP.NET Forum
- Previous Thread: Final Year Project (HELP!!)
- Next Thread: about CDONTS
| Thread Tools | Search this Thread |
.net 3.5 ajax alltypeofvideos appliances asp asp.net bc30451 beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iis javascript list listbox login microsoft mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols problem radio redirect registration relationaldatabases reportemail save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopemnt webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers





