473,399 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

FormView

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>
Apr 6 '06 #1
1 2153
Do any changes in the DataBound event method.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Andre" <we*******@cablevision.qc.ca> wrote in message
news:Oi**************@TK2MSFTNGP05.phx.gbl...
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>

Apr 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ottar | last post by:
I have a few numeric fields, and when I update i get the error: "Input string was not in a correct format". Next line:" System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
0
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase...
7
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the...
4
by: J055 | last post by:
Hi I have 2 update buttons in my FormView ('Apply' and 'OK'). I want both buttons to update the data source but the 'OK' button should redirect afterwards. I can see which button is clicked...
2
by: sck10 | last post by:
Hello, I have 3 objects: LinkButton GridView FormView The LinkButton is used to open the FormView in Insert mode. The GridView provides a list of products. When the "Select" link is
0
by: =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= | last post by:
Hello, I read some msdn and other articles about how does databinding among DataSource controls and FormView / GridView controls works but I still don't fully understand to this blackbox. I have...
0
by: LiamLiamLiam | last post by:
G'day all. I having a problem with my formview. I'll ty to explain my situation as best as i can. I have a page with a search field at the top which is just a simple asp:textbox. Below that i...
6
by: Chris | last post by:
I want do my insert to a database using a formview bound to an objectdatasource. I also want to upload a file. I'm quite new to and this is just test code but Is there any way I can pass the file...
1
by: Brad Baker | last post by:
I have created a usercontrol (ascx file) which contains a formview, inside of the formview I have an EditItemTemplate and an ItemTemplate. Both the EditItemTemplate and ItemTemplate have link...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.