C
Cliff
Hi,
I expect with this code to see the FormView in the browser but nothing
appears (no error, no formview).
I checked with variable 'x' and i know there is one record in the dataset.
The formview must be editable.
Did i forget something?
Thanks for help.
code-behind:
-----------
Dim ds As DataSet
Dim d As SqlDataAdapter
Dim sql As String
Dim sConnectionString As String
Dim x As Integer
sConnectionString =
System.Configuration.ConfigurationManager.ConnectionStrings("aspnetdb").ToString()
'in web.config
sql = "SELECT field1, field2 FROM table1 where ....
d = New SqlDataAdapter(sql, sConnectionString)
ds = New DataSet()
x = d.Fill(ds) 'this gives 1 record
FormView1.DataSource = ds
FormView1.DataBind()
aspx file:
---------
<form id="form1" runat="server">
<asp:FormView ID="FormView1" runat="server">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server"
Text="username:"></asp:Label>
<asp:TextBox runat="server" Text='<%# Eval("field1") %>' >
</asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="your age:"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval("field2")
%>'>
</asp:TextBox>
</EditItemTemplate>
</asp:FormView>
</form>
I expect with this code to see the FormView in the browser but nothing
appears (no error, no formview).
I checked with variable 'x' and i know there is one record in the dataset.
The formview must be editable.
Did i forget something?
Thanks for help.
code-behind:
-----------
Dim ds As DataSet
Dim d As SqlDataAdapter
Dim sql As String
Dim sConnectionString As String
Dim x As Integer
sConnectionString =
System.Configuration.ConfigurationManager.ConnectionStrings("aspnetdb").ToString()
'in web.config
sql = "SELECT field1, field2 FROM table1 where ....
d = New SqlDataAdapter(sql, sConnectionString)
ds = New DataSet()
x = d.Fill(ds) 'this gives 1 record
FormView1.DataSource = ds
FormView1.DataBind()
aspx file:
---------
<form id="form1" runat="server">
<asp:FormView ID="FormView1" runat="server">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server"
Text="username:"></asp:Label>
<asp:TextBox runat="server" Text='<%# Eval("field1") %>' >
</asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="your age:"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval("field2")
%>'>
</asp:TextBox>
</EditItemTemplate>
</asp:FormView>
</form>