Hi All,
I am beffudeled to say the least ...
I have code that dynamically populates drop down boxes (in a datagrid - edit
itme template) and sets the selectedindex in the dropdown to the equivalent
value in a DB.
For teams it works (I get the data from the DB) but or designation (game,
practice, exhibition) which I create as follows:
Dim drpD As DropDownList
drpD = CType(e.Item.FindControl("drpD"), DropDownList)
drpD.Items.Insert(0, "Game")
drpD.Items.Item(0).Value = "g"
drpD.Items.Insert(1, "Practice")
drpD.Items.Item(1).Value = "p"
drpD.Items.Insert(2, "Exhibition")
drpD.Items.Item(2).Value = "x"
If Trim(dsGame.Tables("Table").Rows(0).Item("Des").To String()) =
"g" Then
drpD.SelectedIndex = 0
ElseIf
Trim(dsGame.Tables("Table").Rows(0).Item("Des").To String()) = "p" Then
drpD.SelectedIndex = 1
Else
drpD.SelectedIndex = 2
End If
drpD.DataBind()
It always sets the selectedindex to 0. I have set some debug statemetns and
verrified that for an "x" game I go into the else statement. This should
mean that selected index is set to 2 but this does NOT happen.
Any help would be greatly appreciated.
Thank you,
--
Phil Lamey, EIT
CGI Consultant 2 3160
Are you using this pattern?
If Not Page.IsPostBack
' BindData()
End If
--
Ibrahim ULUDAG www.ibrahimuludag.com
"Phil Lamey" <Ph*******@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com... Hi All,
I am beffudeled to say the least ...
I have code that dynamically populates drop down boxes (in a datagrid - edit itme template) and sets the selectedindex in the dropdown to the equivalent value in a DB.
For teams it works (I get the data from the DB) but or designation (game, practice, exhibition) which I create as follows:
Dim drpD As DropDownList drpD = CType(e.Item.FindControl("drpD"), DropDownList) drpD.Items.Insert(0, "Game") drpD.Items.Item(0).Value = "g" drpD.Items.Insert(1, "Practice") drpD.Items.Item(1).Value = "p" drpD.Items.Insert(2, "Exhibition") drpD.Items.Item(2).Value = "x"
If Trim(dsGame.Tables("Table").Rows(0).Item("Des").To String()) = "g" Then drpD.SelectedIndex = 0 ElseIf Trim(dsGame.Tables("Table").Rows(0).Item("Des").To String()) = "p" Then drpD.SelectedIndex = 1 Else drpD.SelectedIndex = 2 End If drpD.DataBind()
It always sets the selectedindex to 0. I have set some debug statemetns and verrified that for an "x" game I go into the else statement. This should mean that selected index is set to 2 but this does NOT happen.
Any help would be greatly appreciated.
Thank you,
-- Phil Lamey, EIT CGI Consultant
Are you using this pattern?
If Not Page.IsPostBack
' BindData()
End If
--
Ibrahim ULUDAG www.ibrahimuludag.com
"Phil Lamey" <Ph*******@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com... Hi All,
I am beffudeled to say the least ...
I have code that dynamically populates drop down boxes (in a datagrid - edit itme template) and sets the selectedindex in the dropdown to the equivalent value in a DB.
For teams it works (I get the data from the DB) but or designation (game, practice, exhibition) which I create as follows:
Dim drpD As DropDownList drpD = CType(e.Item.FindControl("drpD"), DropDownList) drpD.Items.Insert(0, "Game") drpD.Items.Item(0).Value = "g" drpD.Items.Insert(1, "Practice") drpD.Items.Item(1).Value = "p" drpD.Items.Insert(2, "Exhibition") drpD.Items.Item(2).Value = "x"
If Trim(dsGame.Tables("Table").Rows(0).Item("Des").To String()) = "g" Then drpD.SelectedIndex = 0 ElseIf Trim(dsGame.Tables("Table").Rows(0).Item("Des").To String()) = "p" Then drpD.SelectedIndex = 1 Else drpD.SelectedIndex = 2 End If drpD.DataBind()
It always sets the selectedindex to 0. I have set some debug statemetns and verrified that for an "x" game I go into the else statement. This should mean that selected index is set to 2 but this does NOT happen.
Any help would be greatly appreciated.
Thank you,
-- Phil Lamey, EIT CGI Consultant This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ashish Sharma |
last post by:
I have a DropDownList inside a DataList on a page. I want to set the
selectedindex property of the DropDownList to some value.
I bind the DropDownList on the ItemCreated Event of the DataList.
...
|
by: Emil |
last post by:
Can somebody tell me what would be the syntax for having an if statement and
setting the selected index of a radiobuttonlist?
This is my first project using ASP.net and I use C#.
I have a repeater...
|
by: Angel |
last post by:
I have a problem I placed a DropDown list control on my .NET page. I do not
want to perform a postback when something is selected. When I want to get
what was selected in the Client Script I do not...
|
by: Joel Reinford |
last post by:
I am looking for a way to set the selectedindex of a datagrid based on the
datakey value.
For example given this grid with a datakey of OrderID:
OrderID Item
54 A
98 ...
|
by: Eric A. Johnson |
last post by:
Hi Everyone,
I am at my wit's end here. I have a combobox (combyQueryTitle) that I
need to use in order to select a query for my database project. Therefore,
I am using the...
| |
by: Phil Lamey |
last post by:
Hi All,
I am beffudeled to say the least ...
I have code that dynamically populates drop down boxes (in a datagrid - edit
itme template) and sets the selectedindex in the dropdown to the...
|
by: Nathan Sokalski |
last post by:
I have a control that I want displayed in all items except the last one. I
figured the best way to do this was to determine whether the current item
was the last from within the ItemDataBound event...
|
by: pleaseexplaintome |
last post by:
Hi all,
I have a datagrid with a dropdownlist and would like to have the
dropdownlist display a database value correctly while the grid is in
edit mode.
I have a templatecolumn as follows:
...
|
by: marcbb |
last post by:
Hi all,
I have a really strange problem working with Dropdownlists in a
DataGrid.
I'm trying to preselect some values from the DropDownlist for each
row in the DataGrid, but it seems that...
|
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...
|
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...
| |
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...
|
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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
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...
| |