Dropdown list problem

Results 1 to 2 of 2

Thread: Dropdown list problem

  1. #1
    Join Date
    Dec 1969

    Default Dropdown list problem

    Hi, would like to seek for advice.. I want to populate a datagrid, within the datagrid, one column will be a dropdown list. The items in dropdown list will depend on the value for each row. Eg, the first row id = a, then I use the value a to fetch certain data to populate the dropdown list. How would I do that?<BR><BR>I have tried to add in a datagrid, created those necessary columns, plus one templateColumn for the dropdown list. In the dropdown list, I set the datasource to call a function that return a dataset... The problem is I need to pass in a parameter into the function, while the parameter is the value from another column in the grid. The systax below threw me an error saying that "The server tag is not well formed." Please help..<BR><BR>&#060;asp:DropDownList id="DropDownList1" DataValueField="service_number" DataTextField="service_number" DataSource="&#060;%# getVAS(DataBinder.Eval(Container.DataItem, "service_number"))%&#062;" runat="server" Width="114px" Height="27px" Font-Size="XX-Small"&#062;&#060;/asp:DropDownList&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Dropdown list problem

    I am not near my code to verify the exact syntax, but here is what I think you may need to do.<BR><BR>on your item_ondatabound event of your datagrid, you need to set your datasource there for your dropdown ie:<BR>sql = "SELECT coulmn1 FROM table1 WHERE column2 = &#039;" & e.Item("column2") & "&#039;"<BR>ddl.datasource = {datareader}<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts