problem for dropdown list in itemtemplate

Discussion in 'ASP .Net' started by Guest, Feb 14, 2006.

  1. Guest

    Guest 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
     
    Guest, Feb 14, 2006
    #1
    1. Advertisements

  2. Guest

    Guest 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
     
    Guest, Feb 14, 2006
    #2
    1. Advertisements

  3. Guest

    Guest 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!
     
    Guest, Feb 14, 2006
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.