468,115 Members | 2,078 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,115 developers. It's quick & easy.

how do you get data out of a detailsview

I'm using a detailsview to insert a record, should be simple enough? What
am I doing wrong? Thank you for your help.

The user fills in all the textboxes and hits insert.
I've tried every event there is to retrieve cells and rows and I've even
converted some of the fields from bound controls to templates, and all the
data is blank no matter what I do:

<asp:DetailsView ID="dvBillingServiceInsert" runat="server"
AutoGenerateRows="False" DefaultMode="Insert" Width="722px"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
<asp:TemplateField SortExpression="Section" HeaderText="Section:">
<asp:Label ID="lblSection" runat="server" Text='<%#
Bind("SectionName") %>'></asp:Label>
<asp:TextBox ID="txtNewSection"
<br />
<asp:BoundField DataField="FirstName" HeaderText="First Name:" />
<asp:BoundField DataField="LastName" HeaderText="Last Name:" />
<asp:CommandField ShowInsertButton="True" />
<FooterStyle BackColor="White" ForeColor="#000066" />
<RowStyle ForeColor="#000066" />
<PagerStyle BackColor="White" ForeColor="#000066"
HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White"
Code Behind (I have tried every event, the itemInserting event, the
itemUpdating, the prerender, databound, every every every event there is for
the detailsview), and the values are all "" even though I have put data in
the cells:

Dim row As DetailsViewRow = Sender.Rows(1)
Dim str as String = row.Cells(1).text
Dim item as New ListItem(str)

Dim row2 As DetailsViewRow = Sender.Rows(2)
Dim str2 as String = row2.Cells(1).text
Dim item2 as New ListItem(str2)
Dim item4 as New ListItem("testing")

Oct 29 '08 #1
0 1717

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Andrew Robinson | last post: by
reply views Thread by le0 | last post: by
reply views Thread by wardemon | last post: by
5 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.