FormView

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="<%$ ConnectionStrings:pacsConnectionString %>"
SelectCommand="..."
UpdateCommand="..." >
<parameters>...<>
</asp:SqlDataSource>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top