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:DetailsVie w ID="dvBillingSe rviceInsert" runat="server"
GridLines="None "
AutoGenerateRow s="False" DefaultMode="In sert" Width="722px"
BackColor="Whit e"
BorderColor="#C CCCCC" BorderStyle="No ne" BorderWidth="1p x"
CellPadding="3" >
<Fields>
<asp:TemplateFi eld SortExpression= "Section" HeaderText="Sec tion:">
<ItemTemplate >
<asp:Label ID="lblSection " runat="server" Text='<%#
Bind("SectionNa me") %>'></asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox ID="txtNewSecti on"
runat="server"> </asp:TextBox>
<br />
</EditItemTemplat e>
</asp:TemplateFie ld>
<asp:BoundFie ld DataField="Firs tName" HeaderText="Fir st Name:" />
<asp:BoundFie ld DataField="Last Name" HeaderText="Las t Name:" />
<asp:CommandFie ld ShowInsertButto n="True" />
</Fields>
<FooterStyle BackColor="Whit e" ForeColor="#000 066" />
<RowStyle ForeColor="#000 066" />
<PagerStyle BackColor="Whit e" ForeColor="#000 066"
HorizontalAlign ="Left" />
<HeaderStyle BackColor="#006 699" Font-Bold="True" ForeColor="Whit e"
/>
</asp:DetailsView >
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).te xt
Dim item as New ListItem(str)
ListBox1.Items. Add(item)
Dim row2 As DetailsViewRow = Sender.Rows(2)
Dim str2 as String = row2.Cells(1).t ext
Dim item2 as New ListItem(str2)
ListBox1.Items. Add(item2)
Dim item4 as New ListItem("testi ng")
listbox1.Items. Add(item4)
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:DetailsVie w ID="dvBillingSe rviceInsert" runat="server"
GridLines="None "
AutoGenerateRow s="False" DefaultMode="In sert" Width="722px"
BackColor="Whit e"
BorderColor="#C CCCCC" BorderStyle="No ne" BorderWidth="1p x"
CellPadding="3" >
<Fields>
<asp:TemplateFi eld SortExpression= "Section" HeaderText="Sec tion:">
<ItemTemplate >
<asp:Label ID="lblSection " runat="server" Text='<%#
Bind("SectionNa me") %>'></asp:Label>
</ItemTemplate>
<EditItemTempla te>
<asp:TextBox ID="txtNewSecti on"
runat="server"> </asp:TextBox>
<br />
</EditItemTemplat e>
</asp:TemplateFie ld>
<asp:BoundFie ld DataField="Firs tName" HeaderText="Fir st Name:" />
<asp:BoundFie ld DataField="Last Name" HeaderText="Las t Name:" />
<asp:CommandFie ld ShowInsertButto n="True" />
</Fields>
<FooterStyle BackColor="Whit e" ForeColor="#000 066" />
<RowStyle ForeColor="#000 066" />
<PagerStyle BackColor="Whit e" ForeColor="#000 066"
HorizontalAlign ="Left" />
<HeaderStyle BackColor="#006 699" Font-Bold="True" ForeColor="Whit e"
/>
</asp:DetailsView >
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).te xt
Dim item as New ListItem(str)
ListBox1.Items. Add(item)
Dim row2 As DetailsViewRow = Sender.Rows(2)
Dim str2 as String = row2.Cells(1).t ext
Dim item2 as New ListItem(str2)
ListBox1.Items. Add(item2)
Dim item4 as New ListItem("testi ng")
listbox1.Items. Add(item4)