problem for dropdown list in itemtemplate

G

Guest

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="True"
OnSelectedIndexChanged="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
 
G

Guest

Hi Brian,

in your DDL event, it should look like EventName(object sender,
System.EventArgs e), cast sender to DDL. And then disable it.

DropDownList ddlA = (DropDownList)sender;
ddlA.Enabled = false;


HTH

Elton Wang
 
G

Guest

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

Protected Sub EventName_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles DataGridName.SelectedIndexChanged

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top