javagair
asked on
why am I getting System.Data.DataRowView as answer?
have this gridview which has dropdownlists
<asp:gridview id="CustomersGridView"
autogeneratecolumns="false "
autogenerateeditbutton="tr ue"
onrowdatabound="CustomersG ridView_Ro wDataBound "
onrowediting="CustomersGri dView_RowE diting"
onRowCancelingEdit="Custom er_RowCanc elingEdit"
onRowUpdating="Customers_R owUpdating "
runat="server">
<columns>
<asp:boundfield datafield="WORKDATE"
readonly="true"
headertext="DAY"/>
<asp:boundfield datafield="STARTDAY"
readonly="true"
headertext="DAY"/>
<asp:TemplateField HeaderText="IN">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" >
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
in the onrowUpdatating function I have this to fill the dropdownlist1
If e.Row.RowType = DataControlRowType.DataRow Then
Try
sqlfindhrsfill = "Select JobCode from testday "
Using adapter7 As SqlDataAdapter = New SqlDataAdapter(sqlfindhrsf ill, Connection)
Connection.Open()
adapter7.Fill(Dst, "Dsthrslist")
Connection.Close()
Dim ddl = DirectCast(e.Row.FindContr ol("DropDo wnlist1"), DropDownList)
ddl.DataSource = Dst.Tables("DsthrsList")
ddl.DataBind()
End Using
Catch
End Try
End If
the sql table has a series of numbers: 0:00, 0:15 0:30 which amounts to a 24hr clock. There are 97 entries
what I get on the dropdownlist is the line System.Data.DataRowView 97 times.
any suggestions
gary
<asp:gridview id="CustomersGridView"
autogeneratecolumns="false
autogenerateeditbutton="tr
onrowdatabound="CustomersG
onrowediting="CustomersGri
onRowCancelingEdit="Custom
onRowUpdating="Customers_R
runat="server">
<columns>
<asp:boundfield datafield="WORKDATE"
readonly="true"
headertext="DAY"/>
<asp:boundfield datafield="STARTDAY"
readonly="true"
headertext="DAY"/>
<asp:TemplateField HeaderText="IN">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" >
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
in the onrowUpdatating function I have this to fill the dropdownlist1
If e.Row.RowType = DataControlRowType.DataRow
Try
sqlfindhrsfill = "Select JobCode from testday "
Using adapter7 As SqlDataAdapter = New SqlDataAdapter(sqlfindhrsf
Connection.Open()
adapter7.Fill(Dst, "Dsthrslist")
Connection.Close()
Dim ddl = DirectCast(e.Row.FindContr
ddl.DataSource = Dst.Tables("DsthrsList")
ddl.DataBind()
End Using
Catch
End Try
End If
the sql table has a series of numbers: 0:00, 0:15 0:30 which amounts to a 24hr clock. There are 97 entries
what I get on the dropdownlist is the line System.Data.DataRowView 97 times.
any suggestions
gary
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If no one pops in with the correct answer sooner, I'll throw together a throw-away project at home and provide you with the correct approach.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
right answer, but kaufmed made we think about rows when I was missing the point.
ASKER
I am thinking that to call rows one would have to fill each row with code. I think I read someplace that the ddl knows how to fill from a table, could be wrong! Probably a simple answer that is just alluding me.
usually use a coded list, first attempt at filling with table.
thanks
gary