Solved

why am I getting System.Data.DataRowView as answer?

Posted on 2014-09-30
5
146 Views
Last Modified: 2014-10-05
have this gridview which has dropdownlists
 <asp:gridview id="CustomersGridView"  
       autogeneratecolumns="false"
        autogenerateeditbutton="true"  
        onrowdatabound="CustomersGridView_RowDataBound"
        onrowediting="CustomersGridView_RowEditing"  
        onRowCancelingEdit="Customer_RowCancelingEdit"
        onRowUpdating="Customers_RowUpdating"
       
        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(sqlfindhrsfill, Connection)
                    Connection.Open()
                    adapter7.Fill(Dst, "Dsthrslist")
                    Connection.Close()
                    Dim ddl = DirectCast(e.Row.FindControl("DropDownlist1"), 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
0
Comment
Question by:javagair
  • 3
  • 2
5 Comments
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 500 total points
ID: 40353269
Not 100% on this, but try changing this line:

ddl.DataSource = Dst.Tables("DsthrsList")

...to this:

ddl.DataSource = Dst.Tables("DsthrsList").Rows

Open in new window

0
 

Author Comment

by:javagair
ID: 40353287
tried it, sadly no.
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
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40353290
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.
0
 

Accepted Solution

by:
javagair earned 0 total points
ID: 40353310
the answer is:
didn't tell it what field in table to put.
   ddl.DataTextField = "Jobcode"
                    ddl.DataValueField = "JobCode"

Started at that code for an hour and didn't catch that two lines are missing, even though I put them in html code when needed.

thanks for the offer

gary
0
 

Author Closing Comment

by:javagair
ID: 40361909
right answer, but kaufmed made we think about rows when I was missing the point.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question