473,748 Members | 6,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Databinding in InsertItemTempl ate of FormView

Hello

I have a FormView with InsertItem, EditItem and ItemTemplates.
Depending on from where the page is accessed, the page opens up in
either Insert, Edit or ReadOnly mode. The FormView is databound. The
problem I have is when the page opens up in Insert Mode. I require one
of the fields to be populated with a databound field, but for some some
reason this doesnt happen in the InsertMode.

Following is the FormView:

<asp:FormView ID="FormView1" runat="server"
DataSourceID="S qlDataSource1" >
<EditItemTempla te>
Client Name:
<asp:Label ID="nameLabel" runat="server" Text='<%#
Bind("name") %>'></asp:Label><br />
<asp:LinkButt on ID="UpdateButto n" runat="server"
CausesValidatio n="True" CommandName="Up date"
Text="Update"></asp:LinkButton
</EditItemTemplat e>
<InsertItemTemp late>
Client Name:
<asp:Label ID="nameLabel" runat="server" Text='<%#
Bind("name") %>'></asp:Label><br />
<asp:LinkButt on ID="InsertButto n" runat="server"
CausesValidatio n="True" CommandName="In sert"
Text="Insert"></asp:LinkButton>
</InsertItemTempl ate>
<ItemTemplate >
Client Name:
<asp:Label ID="nameLabel" runat="server" Text='<%#
Bind("name") %>'></asp:Label><br />
<asp:LinkButt on ID="EditButton " runat="server"
CommandName="Ed it" Text="Modify"></asp:LinkButton>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:Plus32Connec tionString %>"
InsertCommand=" addNew" InsertCommandTy pe="StoredProce dure"
SelectCommand=" select clientID, name where packageID = @packageID">
<SelectParamete rs>
<asp:QueryStrin gParameter Name="packageID "
QueryStringFiel d="packageID" Type="Int32" />
</SelectParameter s>
<InsertParamete rs>
<asp:Paramete r Name="clientID" Type="Int32" />
</InsertParameter s>
</asp:SqlDataSour ce>

The binding in the InsertItemTempl ate does not happen. Can someone
explain why this is happening? And how can I work around this?

Nov 19 '05 #1
0 1412

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

Similar topics

6
3571
by: John Bailey | last post by:
I have a web page with a formview, and a multiview in the formview. When I databind the values inside the multiview views, there is no option for two-way databinding. The form populates fine, but when it calls the update method, it calls it with no parameters. Is there just no support for two-way databinding inside these controls, or is there a technique I am missing?
3
1860
by: John Bailey | last post by:
When I first built a few web pages in ASP .Net 2.0, I thought it was great. The formview and detailview contorls would automatically layout the controls for you, the update methods were automatically generated, and the objectdatasource let you design against a business object through the gui. Now I am working on my first real web application on 2.0, and I find this automatic functionality doesn't do much beyond allowing me to generate...
1
2145
by: thzero | last post by:
Is there any way to do this without using the ObjectDataSource? (Apologies for the long post) I have a simple data object: public class TestDO { public TestDO() {} public ID { get; set; } public Name { get; set; } public Description { get; set; }
2
4267
by: John R. Lewis | last post by:
I posted this yesterday with a different email address. I am reposting with my fake-address as given to me by Microsoft so that I can be guraranteed a response from a support representative. Sorry for the repost. I'd like to make use of the asp:Wizard control to present a step-by-step guided experience for my user to fill out a complicated data-entry form. I'd like to make use of two-way databinding provided by the asp:FormView control...
0
1922
by: moi | last post by:
Hello, With ASP.NET 2 , i have two dropdownlist, one "A" (not in a formview) in the web page and other one "B" in a Insert Template in a formview. There's a link (parameter between this two dropdownlist. When i selected a new item in the A dropdownlist, i have this error message : Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control" when i disable EnableStateView for the formview,...
0
1328
by: Wayne Sepega | last post by:
I have the following Object DataSource <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetCustomer" TypeName="Customers" DataObjectTypeName="Customer" InsertMethod="InsertCustomer" OnUpdated="ObjectDataSource1_Updated" UpdateMethod="UpdateCustomer" OnSelected="ObjectDataSource1_Selected">
0
1690
by: jobs at webdos | last post by:
I have a formview that will either edit or insert records into a database. when I call the page with a query string ?x= its goes to edit mode and loads data from a datasource in the form and load data into the dropdown (from another datasource) with no problem. I'm using the same dropdownlist tag for both edit and insert, however the dropdown only get populated in insert mode... <asp:DropDownList ID="RouteCodeList" runat="server"...
0
1190
by: hooterbite | last post by:
The forms in Insert and Edit are almost identical, and each fom field has the same name in each template. For example, I have a txbName in the InsertItemTemplate and a txbName in the EditItemTemplate. My project has been fine until today, and now it says that " The ID 'txbName' is already used by another control." I did not change anything in my code. Anyone know why this would change, why I would start getting this error now when the page...
2
5697
by: npei72 | last post by:
I have a simple Formview like this: <%@ Page Language="C#" EnableViewState="true" AutoEventWireup="true" CodeFile="HelloWorld.aspx.cs" Inherits="_HelloWorld"%> <html> <body> <form runat="server"> <asp:FormView DataSourceID="myODS" ID="ItemFormView"
0
8987
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9241
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.