473,402 Members | 2,072 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,402 software developers and data experts.

default values from the database formview insert mode

hey all,
has anyone ever bound data to a formview that's in Insert Mode? For example,
if you had to get default values from the database for a new record?

thanks,
rodchar
Jun 27 '08 #1
3 2368
Hello rodchar,

You need either to make a call to SQL in before add row event, to extract
default values from system tables and fill editable row
or make an silent insert of dummy values and get resulted data

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
rhey all,
rhas anyone ever bound data to a formview that's in Insert Mode? For
rexample,
rif you had to get default values from the database for a new record?
Jun 27 '08 #2
Hello rodchar,

You can try the following:

Atach an event handler to DataBinding event on the control(s) from
InsertTemplate.
<asp:TextBox id= "txtNumber" OnDataBinding =
"txtNumber_InsertDataBinding" ..

In the event handler initialize the text property.

protected void txtNumber_InsertDataBinding(object sender, EventArgs e)
{
TextBox txtNumber = (TextBox) sender;

// Retrieve and assign default number
txtNumber.Text = NewNumber();
}

Hope this helps,
Alexander Myachin

Jun 27 '08 #3
thanks everyone for the help,
rod.

"rodchar" wrote:
hey all,
has anyone ever bound data to a formview that's in Insert Mode? For example,
if you had to get default values from the database for a new record?

thanks,
rodchar
Jun 27 '08 #4

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

Similar topics

3
by: Michael Glass | last post by:
I'm working on an ASP.Net web app using VS2005 and the .Net 2.0 framework, and I have a serious problem with the page I'm currently working on. The page has, among other things, two FormViews and a...
0
by: Swetha | last post by:
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...
2
by: Gary Homewood | last post by:
Where can I specify a default value for a column when using a FormView? Specifically, I have a checkbox for a column of bit datatype on my database, and I'd like to default it to checked for insert...
2
by: sck10 | last post by:
Hello, I have a LinkButton that I use to open a FormView in ReadOnly mode "ShowList", and a LinkButton to open the same FormView in the Insert mode "NewRecord". If the user clicks "ShowList"...
1
by: Ben | last post by:
I have a formview with a few dropdownlists (software version, database version, etc). When a software version is selected, the database version dropdownlist updates itself accordingly. When in...
1
by: J055 | last post by:
Hi I'd like to do the following with the FormView/ObjectDataSource but not sure of the best approach. 1. Change the FormView mode to Edit if a valid QueryString ID exists or Insert mode if it...
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
5
by: J055 | last post by:
Hi How do I keep the values of the controls in a FormView after a PostBack in Insert mode? Thanks Andrew
5
by: nzkks | last post by:
Hi I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005, Formview controls In a ASP.Net form I have 20 textboxes and 20 dropdownlists(ddl). All ddl(s) are databound and get...
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
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,...
0
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...
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
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...

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.