FORM value not bein inserted when posting to sql server

  • Thread starter Thread starter con
  • Start date Start date
C

con

I have created a aspx page which contains a formview with the state set to
"insert", I prepopulate some of the data as seen below and this is visible
on the form.
The information appears on the form but when I view the post via sql
profilter , the data that was "created" from the eval is null?


SQL server 2003
vs 2005
..net framework 2.0


code snippet from aspx page


<asp:TemplateField HeaderText="by User" SortExpression="lastid">
<EditItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Text='<%#
Setid(Eval("lastid")) %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%#
Bind("lastid") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

VB backend code

Public Function setid(ByVal itemtype As Object) As Object
Return "test"
End Function

sql snippet value passed to storedprocedure

@lastid = NULL
 
Solved the null posting;

set the binding to two way as the source was from an object I moved the key
to the first column and the issue appears to have been rectified.
Unsure as to why this all worked but i hope it saves somebody some time.
 
Back
Top