473,378 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

DropDownList Problem

2
Hi community, I'm having a problem,

I dinamically create a table wich contains the results of a search, in each row of that table I create a dropdownlist called DD_ACTIONS and add this AddHandler DD_ACTIONS.SelectedIndexChanged, AddressOf DD_ACTIONS_Selected_Index_Change[/i] in order to execute the code when the Selected Index Change, so the problem is that it works but only once because on the postback event of the page the table containing the dropdownlist is created again so the values of the dropdownlists are always the same, any suggestions???

Regards...
Nov 1 '06 #1
2 1278
mdaRock
26
Dear Ring,

try to use the boolean function IsPostBack Page level to customize your query.

If I miss somthing please post your filling code so we can modifay it togather.

Regards.



Hi community, I'm having a problem,

I dinamically create a table wich contains the results of a search, in each row of that table I create a dropdownlist called DD_ACTIONS and add this AddHandler DD_ACTIONS.SelectedIndexChanged, AddressOf DD_ACTIONS_Selected_Index_Change[/i] in order to execute the code when the Selected Index Change, so the problem is that it works but only once because on the postback event of the page the table containing the dropdownlist is created again so the values of the dropdownlists are always the same, any suggestions???

Regards...
Nov 1 '06 #2
Ring
2
Thanks mdaRock

when I create the table there is a cell where I create each dropdownlist, the code for add this cell is

'DOCUMENT ACTIONS
Dim TC_ACTION_ITEM As New TableCell
TC_ACTION_ITEM.HorizontalAlign = HorizontalAlign.Right
Dim DD_ACTIONS As New DropDownList
AddHandler DD_ACTIONS.SelectedIndexChanged, AddressOf DD_ACTIONS_Selected_Index_Change
DD_ACTIONS.ID = myReader("DocumentID")
DD_ACTIONS.DataSource = SqlDataSource1
DD_ACTIONS.DataTextField = "FunctionName"
DD_ACTIONS.DataValueField = "FunctionID"

'CREATE "CHOOSE ACTION" ITEM
Dim liCA As New ListItem
liCA.Text = "Choose Action"
liCA.Value = "-1"

'CREATE "OPEN DOCUMENT ACTION" ITEM
Dim liOD As New ListItem
liOD.Text = "Open Document"
liOD.Value = "-2"

DD_ACTIONS.Items.Add(liCA)
DD_ACTIONS.Items.Add(liOD)
DD_ACTIONS.AppendDataBoundItems = True
DD_ACTIONS.AutoPostBack = True
DD_ACTIONS.EnableViewState = True
DD_ACTIONS.DataBind()
TC_ACTION_ITEM.Controls.Add(DD_ACTIONS)
TR2.Cells.Add(TC_ACTION_ITEM)

then on the DD_ACTIONS_Selected_Index_Change Sub what I'm doing is this:

Select Case sender.SelectedValue
Case "-1"
'CHOOSE ACTION: DO NOTHING
Case "-2"
'CHECK(DATABASE)
Case Else
"DO SOMETHING
End Select

but the problem is that on the postback the cell that contains the dropdownlists needs to be created, an the postback ocurr before the DD_ACTIONS_Selected_Index_Change Sub so each time you enter the Sub the selectedValue is the same it never change...



Dear Ring,

try to use the boolean function IsPostBack Page level to customize your query.

If I miss somthing please post your filling code so we can modifay it togather.

Regards.
Nov 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Brennon Arnold | last post by:
I have a problem that I figured would be relatively common, but have been unable to find any information on it as of yet. I have a page that contains two DropDownList controls, with the second...
12
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option...
2
by: Antonio D'Ottavio | last post by:
Good Morning, In my web page I've a datalist that is sourced by a database, the problem is that I want that one of the column of the datalist contain a dropdownbox that also is sourced by a table...
1
by: Antonio D'Ottavio | last post by:
Good morning, I've a problem with a dropdownlist located inside any row of a datalist, I fill both datalist and dropdownlist at runtime, the problem is with the dropdownlist infact using the event...
10
by: dhnriverside | last post by:
Hi guys Still having a problem with this dropdownlist. Basically, I've got 4. The first 2 work fine, then my code crashes on the 3rd. ddlEndTimeHour.Items.FindByValue(endTime).Selected =...
4
by: Mark Waser | last post by:
I've discovered a very odd bug when attempting to put a dropdown list in a datagrid. In the page PreRender step, the selected index of the datagrid is successfully set during databinding. Yet,...
0
by: Juanjo | last post by:
Hi, Before, I was working with Asp.net 1.0 and datagrid. I posted a question for this issue. The solution of this problem is load the second dropdownlist on the selectedindexchanged event of the...
3
by: Lohboy | last post by:
Using ASP.NET and IE7. (Sorry if I am posting in the wrong forum but my problem seemed to be more related to the JavaScript side than the ASP.NET side.) I have two DropDownList controls the...
1
by: Brett | last post by:
I have a DropDownList in an ASP.NET web form that is populated with items from a lookup table by binding that DropDownList to a SqlDataSource. However, the items in the lookup table can change over...
6
by: shashi shekhar singh | last post by:
Respected Sir, I have to create multiple dynamic dropdownlist boxes and add items dynamically in <asp:table> server control but problem occurs , i.e. except of fist dropdown list no dropdownlist...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.