473,790 Members | 3,185 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem for dropdown list in itemtemplate

Hi, All,
I have two dropdown lists in itemtemplate in a datagrid. for example, dropA
and dropB. also, for the dropdown, I set < Runat="server" AutoPostBack="T rue"
OnSelectedIndex Changed="some event name"> When users selects an item, it will
do a postback to server. Before the postback completes and the page
refreshes, click any dropdown menu again (either dropA or dropB) the frame
page will become blank out. I must to click F5 or refresh button to reload
the page. the problem is the two dropdown menu are in itemTemplate, so, they
may have more than one row. How could I disable the dropdown menus once they
has been click and enable them later.

any ideas?

Thank you for your help

Brian

Feb 14 '06 #1
2 1374
Hi Brian,

in your DDL event, it should look like EventName(objec t sender,
System.EventArg s e), cast sender to DDL. And then disable it.

DropDownList ddlA = (DropDownList)s ender;
ddlA.Enabled = false;
HTH

Elton Wang
"Brian" wrote:
Hi, All,
I have two dropdown lists in itemtemplate in a datagrid. for example, dropA
and dropB. also, for the dropdown, I set < Runat="server" AutoPostBack="T rue"
OnSelectedIndex Changed="some event name"> When users selects an item, it will
do a postback to server. Before the postback completes and the page
refreshes, click any dropdown menu again (either dropA or dropB) the frame
page will become blank out. I must to click F5 or refresh button to reload
the page. the problem is the two dropdown menu are in itemTemplate, so, they
may have more than one row. How could I disable the dropdown menus once they
has been click and enable them later.

any ideas?

Thank you for your help

Brian

Feb 14 '06 #2
Thanks, Elton,
I tried what you told me but it doesn't work. The codes looks like,

Protected Sub EventName_Selec tedIndexChanged (ByVal sender As Object, ByVal
e As System.EventArg s) Handles DataGridName.Se lectedIndexChan ged

Dim ddlA As DropDownList
ddlA = CType(sender, DropDownList)
ddlA.Enabled = False
......
......
End sub

after I clicked the dropdowns first time, it still can be selected for the
second time. it looks like the enable of dropdown hasn't been set to false.

did I miss something?

thank you!

"Elton W" wrote:
Hi Brian,

in your DDL event, it should look like EventName(objec t sender,
System.EventArg s e), cast sender to DDL. And then disable it.

DropDownList ddlA = (DropDownList)s ender;
ddlA.Enabled = false;
HTH

Elton Wang
"Brian" wrote:
Hi, All,
I have two dropdown lists in itemtemplate in a datagrid. for example, dropA
and dropB. also, for the dropdown, I set < Runat="server" AutoPostBack="T rue"
OnSelectedIndex Changed="some event name"> When users selects an item, it will
do a postback to server. Before the postback completes and the page
refreshes, click any dropdown menu again (either dropA or dropB) the frame
page will become blank out. I must to click F5 or refresh button to reload
the page. the problem is the two dropdown menu are in itemTemplate, so, they
may have more than one row. How could I disable the dropdown menus once they
has been click and enable them later.

any ideas?

Thank you for your help

Brian

Feb 14 '06 #3

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

Similar topics

2
6928
by: Michelle | last post by:
Hello, I put a dropdown list in ItemTemplate Column. I can select its value from the dropdown list and store in a dataset, but when I retrieve records from dataset, it doesn't show up in the datagrid. Is there anything I missed? and where can I find something for reference? Thanks. Here is html code snippets.
0
2010
by: Mark | last post by:
Hi, I have a datalist that contains a textbox as well as a dropdown list. For each single row in the datalist the associated dropdown list can have at least one value What I would like to be able to do is when a single update button is clicked the textbox value along with the associated dropdown value is printed for each row in the datalist. The number of rows in the datalist can vary. Here is my Datalist code
0
1178
by: Darren Clark | last post by:
Is it possible to nest a drop down list in a repeater? (also the repeater has a nested repeater) The code i am using looks like.... i get an error saying that Exception Details: System.Web.HttpException: DataBinder.Eval: 'System.Data.DataRow' does not contain a property with the name topic. If i remove the dropdown list code it works fine... Any ideas? <asp:Repeater ID="SectionRepeater" Runat="server">
6
5398
by: Jenna Alten | last post by:
I have a datagrid with a template column that contains a dropdown list. I currently fill and display the dropdown list on the page load. This is working correctly. I am NOT using an Edit Column. I am receiving errors when trying to set the selected value of the dropdown within the ItemDataBound() subroutine. Below is the code I am using. I hope someone can tell me if this is possible. '''HTML''' <asp:datagrid id="dgAssignments"...
1
6495
by: sck10 | last post by:
Hello, I am using the following in a GridView. Currently, I am using a dropdown that pulls the Name of the person, given the Employee ID. I am doing this in both the ItemTemplate and the EditTemplate. This makes sense for the EditTemplate becuase the user can then change the Employee using the dropdown box. What I am trying to figure out is how to show the Employee Name in the ItemTemplate without having to use a DropDownList Box. ...
4
29540
by: Dabbler | last post by:
I have two tables I'm editing in a Gridview. The VANS table contains a key to the other LESSOR table. I would like to use a dropdown list to select the LessorId value while displaying the Lessor table's "Company" field as text. When I commit the edit I get error:Must declare the scalar variable "@LessorId". Also as a bonus question ;) I don't know how to set the selectedindex value in the dropdown list based on the LessorId value in the...
2
2855
by: Peter | last post by:
ASP.NET 2003 In the DataGrid how do I select current cell value in the dropdown box when I click on the edit link, currently when I click on the edit link in the DataGrid the dropdown box appears in the cell, but allways the first item in the dropdown box is shown not the current cell value? How do I make the current value in the cell automaticaly be selected in the dropdown box.
0
940
by: Mike C | last post by:
I've been grappling with this for days and hope someone has some suggestions. I have a datagrid that I'd like to place entirely in edit mode so people don't have to update data row by row. I've accomplished this but my dropdown list is no longer bound to the data source. It just defaults to the first item in the dropdown list source table. Thanks! <asp:TemplateColumn HeaderText="COMPANY"> <ItemTemplate> <asp:Label runat="server"...
0
1412
by: Chicagoboy27 | last post by:
I am wondering how to set an object datsource or any data source for a dropdown list that is a details view. Here is a brief set up. I have a details view that lists a bunch of information. when a user clicks and edit button a few of the fields become editable or unhidden in this example..... There are two types of roles for this system and depending on which role you are in you have a different data source for the dropdown list.... Here...
0
9512
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
10419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10147
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
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...
0
6770
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
5424
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
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
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.