I have a gridview in a Web app and I changed one of the fields to a
dropdownlist.
My dilema is I want to populate the items from one source (sql table)
but the SelectedValue exits in a different source (different table).

So I have
<asp:TemplateField HeaderText="Status">
   <ItemTemplate>
        <asp:DropDownList ID="ddlStatus" runat="server">
        </asp:DropDownList>
   </ItemTemplate>

and in code behind

Protected Sub GridView1(...)
   Dim dt As DataTable = getData 'fills datatable

If e.Row.RowType = DataControlRowType.DataRow Then
  Dim sd As List(Of vb.Status) = getStatus
  Dim ddl As DropDownList = CType(e.Row.FindControl("ddlStatus"),
DropDownList)

  ddl.DataSource = sd
  ddl.DataTextField = "Status"
  ddl.DataValueField = "StatusID"
  ddl.DataBind()

End If
End Sub


... But I want to be able to set the default value to that in the
DataTable. Any suggestions?
Thanks...

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to