Solved

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

Posted on 2014-09-30
5
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 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