A
Andre
Hi,
I try to change some value in the databind of my formview, but can't
find a way to dot it.
In Asp.net 1.1 i was using someting like this :
Public Sub item_bound(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If e.Item.DataItem("phone") = "1" Then
CType(e.Item.FindControl("label4"),
System.Web.UI.WebControls.Label).Text = "True"
But in ASP.NET 2.0 i can't find a way to do this, with a FormView. Do i
have to change the value in the formview databound or in the sqlDataSource ?
Did someone have any URL or anything with an example ?
Here's a copy (part) of my FormView :
<asp:FormView ID="FormView1" DataSourceID="sqldatasource1"
runat="server" DataKeyNames="noauto">
<EditItemTemplate>
<table>
<tr>
<td>ID : </td>
<td><asp:Label runat=server ID="noauto" Text='<%# Eval("noauto")
%>'></asp:Label></td>
</tr>
<tr>
<td>Prénom (Nickname) : </td>
<td>
<asp:TextBox ID="prenom" runat="server" Text='<%#
Bind("name") %>'></asp:TextBox></td>
</tr>
<tr>
<td>Phone : </td>
<td>
<asp:TextBox ID="phone" runat="server" Text='<%#
Bind("phone") %>'></asp:TextBox></td>
</tr>
</table>
</EditItemTemplate>
<ItemTemplate>
.....
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStringsacsConnectionString %>"
SelectCommand="..."
UpdateCommand="..." >
<parameters>...<>
</asp:SqlDataSource>
I try to change some value in the databind of my formview, but can't
find a way to dot it.
In Asp.net 1.1 i was using someting like this :
Public Sub item_bound(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
If e.Item.DataItem("phone") = "1" Then
CType(e.Item.FindControl("label4"),
System.Web.UI.WebControls.Label).Text = "True"
But in ASP.NET 2.0 i can't find a way to do this, with a FormView. Do i
have to change the value in the formview databound or in the sqlDataSource ?
Did someone have any URL or anything with an example ?
Here's a copy (part) of my FormView :
<asp:FormView ID="FormView1" DataSourceID="sqldatasource1"
runat="server" DataKeyNames="noauto">
<EditItemTemplate>
<table>
<tr>
<td>ID : </td>
<td><asp:Label runat=server ID="noauto" Text='<%# Eval("noauto")
%>'></asp:Label></td>
</tr>
<tr>
<td>Prénom (Nickname) : </td>
<td>
<asp:TextBox ID="prenom" runat="server" Text='<%#
Bind("name") %>'></asp:TextBox></td>
</tr>
<tr>
<td>Phone : </td>
<td>
<asp:TextBox ID="phone" runat="server" Text='<%#
Bind("phone") %>'></asp:TextBox></td>
</tr>
</table>
</EditItemTemplate>
<ItemTemplate>
.....
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStringsacsConnectionString %>"
SelectCommand="..."
UpdateCommand="..." >
<parameters>...<>
</asp:SqlDataSource>