problem for dropdown list in itemtemplate

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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!
 
Back
Top