473,385 Members | 1,829 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,385 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 2152
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.