473,594 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox inside a DataGrid

I have a simple question, I have a datagrid and inside the grid, i have List
box. I am able to render the page with the datagrid and the lisbox values.
Now, my question is how to trap the server side SelectedIndexCh anged event of
the listbox.

Any help in VB.NET would be greatly appreciated.

Thanks

Nov 19 '05 #1
3 1896
Raja:

I assume inside the grid definition you have something like:

<asp:TemplateCo lumn>
<ItemTemplate >
<asp:ListBox
ID="ItemList" Runat="server"
AutoPostBack="T rue"

OnSelectedIndex Changed="DropDo wn_SelectedInde xChanged"/>
</ItemTemplate>
</asp:TemplateCol umn>

The key is setting the AutoPostBack property to true and declaring an
event handler inside the tag. Then add an event handler in the code
behind - the sender parameter will be a reference to the ListBox.

Make sense?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 15 Feb 2005 11:49:01 -0800, "Raja"
<Ra**@discussio ns.microsoft.co m> wrote:
I have a simple question, I have a datagrid and inside the grid, i have List
box. I am able to render the page with the datagrid and the lisbox values.
Now, my question is how to trap the server side SelectedIndexCh anged event of
the listbox.

Any help in VB.NET would be greatly appreciated.

Thanks


Nov 19 '05 #2
Scott,
Thanks for your quick reply. This is very helpful. I have a further
question, hope you will be able to help me.

As I mentioned I have a grid and the gird has dropdown box as a column and i
have one more column that has hyperlink. The NavigateURL for the hyperlink is
to open a new window with a query stirng parameter as the selected value of
the drop down...

here is how it looks like

<asp:TemplateCo lumn>
<ItemTemplate >
<asp:ListBox
ID="ItemList" Runat="server"
AutoPostBack="T rue"
OnSelectedIndex Changed="DropDo wn_SelectedInde xChanged"/>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:hyperlin k runat='server' id='PocketDetai ls'/asp:hyperlink>
</ItemTemplate>
</asp:TemplateCol umn>

The url for the hyperlink contorl ("PocketDetails ") has to be created
dynamically and with the querysting parameter as the selected value of
dropdown box ("ItemList") .

Please help me.

Thanks
Raja
"Scott Allen" wrote:
Raja:

I assume inside the grid definition you have something like:

<asp:TemplateCo lumn>
<ItemTemplate >
<asp:ListBox
ID="ItemList" Runat="server"
AutoPostBack="T rue"

OnSelectedIndex Changed="DropDo wn_SelectedInde xChanged"/>
</ItemTemplate>
</asp:TemplateCol umn>

The key is setting the AutoPostBack property to true and declaring an
event handler inside the tag. Then add an event handler in the code
behind - the sender parameter will be a reference to the ListBox.

Make sense?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 15 Feb 2005 11:49:01 -0800, "Raja"
<Ra**@discussio ns.microsoft.co m> wrote:
I have a simple question, I have a datagrid and inside the grid, i have List
box. I am able to render the page with the datagrid and the lisbox values.
Now, my question is how to trap the server side SelectedIndexCh anged event of
the listbox.

Any help in VB.NET would be greatly appreciated.

Thanks


Nov 19 '05 #3
Raja:

You can use some data binding syntax to set the hyperlink properties
from your datasource - that's just one possible solution.

Perhaps this might give you a tip:
http://odetocode.com/Articles/278.aspx

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 16 Feb 2005 07:31:12 -0800, "Raja"
<Ra**@discussio ns.microsoft.co m> wrote:
Scott,
Thanks for your quick reply. This is very helpful. I have a further
question, hope you will be able to help me.

As I mentioned I have a grid and the gird has dropdown box as a column and i
have one more column that has hyperlink. The NavigateURL for the hyperlink is
to open a new window with a query stirng parameter as the selected value of
the drop down...

here is how it looks like

<asp:TemplateC olumn>
<ItemTemplate >
<asp:ListBox
ID="ItemList" Runat="server"
AutoPostBack="T rue"
OnSelectedInde xChanged="DropD own_SelectedInd exChanged"/>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateC olumn>
<ItemTemplate >
<asp:hyperlin k runat='server' id='PocketDetai ls'/asp:hyperlink>
</ItemTemplate>
</asp:TemplateCol umn>

The url for the hyperlink contorl ("PocketDetails ") has to be created
dynamically and with the querysting parameter as the selected value of
dropdown box ("ItemList") .

Please help me.

Thanks
Raja
"Scott Allen" wrote:
Raja:

I assume inside the grid definition you have something like:

<asp:TemplateCo lumn>
<ItemTemplate >
<asp:ListBox
ID="ItemList" Runat="server"
AutoPostBack="T rue"

OnSelectedIndex Changed="DropDo wn_SelectedInde xChanged"/>
</ItemTemplate>
</asp:TemplateCol umn>

The key is setting the AutoPostBack property to true and declaring an
event handler inside the tag. Then add an event handler in the code
behind - the sender parameter will be a reference to the ListBox.

Make sense?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 15 Feb 2005 11:49:01 -0800, "Raja"
<Ra**@discussio ns.microsoft.co m> wrote:
>I have a simple question, I have a datagrid and inside the grid, i have List
>box. I am able to render the page with the datagrid and the lisbox values.
>Now, my question is how to trap the server side SelectedIndexCh anged event of
>the listbox.
>
>Any help in VB.NET would be greatly appreciated.
>
>Thanks



Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2202
by: ericm1155 | last post by:
I am trying to display some information from a database in a form that displays one record per line. When the user clicks anywhere on a line, that record is highlighted and selected, and my program will respond to that. The problem is that with a listbox control (which is what it sounds like I need), I can't get the information to format at all. \t-Tabs skew the data unpredicatably - it leaves some words closer together on some lines than...
6
2865
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset a denormalized mirror of the database, but I'm not having much luck getting the selection logic down (I haven't found a 'hook' where I can access the listbox object as an object to set the listitem's selected property before it gets rendered).. ...
5
3520
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all selected items of that listbox and display it. can anyone help? Thanks
0
920
by: Sosh | last post by:
Hi, I'm having a bit of a job getting a handle on a ListBox that i've placed in one column of the footer in a DataGrid. Here's what I've tried so far: - Declaring a protected listbox (with the same id as the aspx) in code behind, and accessing that directly.
2
2253
by: Rosanne | last post by:
I have a menu written in javascript. I include that menu on an asp page. The aspx page contains both a listbox and a datagrid. There i one drop down menu that overlaps the place where the listbox is. Whe the user hovers over the drop down menu, the listbox hides the botto options on the menu. However, the menu also overlaps the place wher the datagrid is, but the datagrid does not hide the menu - the men appears over the datagrid as...
0
1532
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box that would Populate another Listbox/datagrid. Then it would cycle through the selections made in the populated listbox/datagrid and do some calculations. The calculations made would have to add the first two numbers in the populated...
0
1399
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box that would Populate another Listbox/datagrid. Then it would cycle through the selections made in the populated listbox/datagrid and do some calculations. The calculations made would have to add the first two numbers in the populated...
9
3212
by: zdrakec | last post by:
Hello all: Clearly, I'm not getting it! Here is the scenario: On a web page, I have two list boxen and a text box. The first listbox is populated at page load time (if it is not a postback). This listbox has AutoPostback = True. When the user selects an item from this list, the second listbox is populated with more items relevant to this selection. I am using an SQLDataSource web control for this. These items are headers. I want, when...
8
6027
by: PeteOlcott | last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html I would like to completely understand how GUI controls such as this one are constructed. In the ideal case I would like to see all of the source code for a complete working example of a ListBox of CheckBoxes.
0
7874
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8227
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5402
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3853
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3893
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1469
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.