Binded DropDown list

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mira Vizjak

    #1

    Binded DropDown list

    Hi
    I'm using a datagrid with a dropdown list in it. The dropdown list is filled
    with values from SQL database, it's autopostback property is set to true and
    when I select another item in it, the SelectedIndexCh anged event fires
    properly, but I can't the index or value of the selected item. SelectedValue
    and SelectedItem is Nothing, Request.Params( "DropDown1" ) is empty as well.
    Thanks for your help!

    Jure


  • Anatoly

    #2
    Re: Binded DropDown list

    Please post some code snippet.
    Probably you fill dropdown every time, use IsPostBack property to fill it
    only first time you enter the page.
    Also check if EnableViewState of dropdown and page is set to true.


    "Mira Vizjak" <mira.vizjak1@g uest.arnes.si> wrote in message
    news:bf1qbl$jf9 $1@planja.arnes .si...[color=blue]
    > Hi
    > I'm using a datagrid with a dropdown list in it. The dropdown list is[/color]
    filled[color=blue]
    > with values from SQL database, it's autopostback property is set to true[/color]
    and[color=blue]
    > when I select another item in it, the SelectedIndexCh anged event fires
    > properly, but I can't the index or value of the selected item.[/color]
    SelectedValue[color=blue]
    > and SelectedItem is Nothing, Request.Params( "DropDown1" ) is empty as well.
    > Thanks for your help!
    >
    > Jure
    >
    >[/color]


    Comment

    • Anatoly

      #3
      Re: Binded DropDown list

      Sorry, can not see any connection between refill dropdown and empty Datagrid
      ???
      Please explain.

      "Mira Vizjak" <mira.vizjak1@g uest.arnes.si> wrote in message
      news:bf2t75$hda $1@planja.arnes .si...[color=blue]
      > Yes, I do fill drop down every time on PageLoad, otherwise the datagrid is
      > empty on postback.
      >
      >[/color]


      Comment

      • Mira Vizjak

        #4
        Re: Binded DropDown list

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
        System.EventArg s) Handles MyBase.Load
        If Security.IsInRo les("Admins") = False Then
        Response.Redire ct("default.asp x")
        End If
        If Page.IsPostBack =False then
        BindGrid()
        End If
        End Sub
        In this case when I select an item from ddl control the datagrid on the page
        posted back is empty.

        If Security.IsInRo les("Admins") = False Then
        Response.Redire ct("default.asp x")
        End If
        BindGrid()
        End Sub
        In this case when I select an item from ddl control the datagrid on the page
        posted back is full.


        Comment

        • Anatoly

          #5
          Re: Binded DropDown list

          I can't see from code you post where do you fill the dropdown.
          Fill it once when Not IsPostBack.

          "Mira Vizjak" <mira.vizjak1@g uest.arnes.si> wrote in message
          news:bf33em$me0 $1@planja.arnes .si...[color=blue]
          > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
          > System.EventArg s) Handles MyBase.Load
          > If Security.IsInRo les("Admins") = False Then
          > Response.Redire ct("default.asp x")
          > End If
          > If Page.IsPostBack =False then
          > BindGrid()
          > End If
          > End Sub
          > In this case when I select an item from ddl control the datagrid on the[/color]
          page[color=blue]
          > posted back is empty.
          >
          > If Security.IsInRo les("Admins") = False Then
          > Response.Redire ct("default.asp x")
          > End If
          > BindGrid()
          > End Sub
          > In this case when I select an item from ddl control the datagrid on the[/color]
          page[color=blue]
          > posted back is full.
          >
          >[/color]


          Comment

          Working...