473,486 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Getting value from dynamic controls postback problem

I create a dynamic control and added it to a panel.

I get the selected value of the control via a btn_click()
but my problem is everytime the page is postback the selected values go back
to the first element in the dropdownlist.

but if i call the control creation with if !=postback then the controls
disappear. and selected values = null.

Any help on this would be great

Thanks all.



Nov 16 '05 #1
1 5610
Very strange thing....
if i give the dropdownlist item's properties:
..Text and .Value
the same value eg. "abc" The btn_click() displays the correct values over
postback, but if one (either .Text or .Value is different it fails.)
anyone know why this should happen??
ListItem tmpResidentListItem;
tmpResidentListItem = new ListItem();
tmpResidentListItem.Text =
getOptionItemName(Convert.ToInt32(myRow2["itemID"].ToString()));
tmpResidentListItem.Value =
getOptionItemName(Convert.ToInt32(myRow2["itemID"].ToString()));
MyDdl.ID = "ddl" + myRow2["categoryID"].ToString();
MyDdl.EnableViewState = true;
MyDdl.Items.Add(tmpResidentListItem);

pnlOptionDdl.Controls.Add( MyDdl );
Thanks
Mike

"Mike" <scul[nospam]li****@hotmail.com> wrote in message
news:6u******************@news-binary.blueyonder.co.uk...
I create a dynamic control and added it to a panel.

I get the selected value of the control via a btn_click()
but my problem is everytime the page is postback the selected values go back to the first element in the dropdownlist.

but if i call the control creation with if !=postback then the controls
disappear. and selected values = null.

Any help on this would be great

Thanks all.



Nov 16 '05 #2

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

Similar topics

1
381
by: Mike | last post by:
I create a dynamic control and added it to a panel. I get the selected value of the control via a btn_click() but my problem is everytime the page is postback the selected values go back to the...
4
7216
by: Tom Wisnowski | last post by:
Hello all, Here is a simple example of what I'm doing... Create a ASPX page Add a PlaceHolder(plch) and a Button(btn) to the page. In the code behind on Page_load add the following......
1
2660
by: Scott Schluer | last post by:
Hello, I've got myself a small problem and I'm hoping someone can help. I have a DataList called dlProducts (displays products from a database). Within the <ItemTemplate> container of the...
2
2539
by: Dave Williamson | last post by:
When a ASPX page is created with dynamic controls based on what the user is doing the programmer must recreate the dynamic controls again on PostBack in the Page_Load so that it's events are wired...
3
1795
by: Tyler Carver | last post by:
I am trying to use some dynamic controls that are built and then added to tables. The problem that I am having is the timing of when I can populate the controls and have the state remain after a...
5
2509
by: PCH | last post by:
I have an c# asp.net (.net 1.1) web page, viewstate on. The problem I am having is on the button click postback to update. Heres the situation: I have an asp table that has 1 header row. ...
0
1325
by: pbb | last post by:
I have a web page on which I dynamically create controls based on the selection a user makes from a dropdownlist (this ddl is not dynamic). Depending on the user's selection, the controls could be...
2
2919
by: Ben Amada | last post by:
I'm a little confused about in what Event should I add dynamic controls and in what Event should I retrieve the value of a dynamic control on postback. I've found that adding dynamic controls in...
2
3995
by: paulcis | last post by:
I am trying to produce a dynamic form from a database with unknown amount of records. I need to read the values and create a new textbox for each. I need to create the textboxes at page_init stage...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7319
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...
0
5430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4559
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...
0
3069
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...
0
1378
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 ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
262
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...

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.