[I posted this previously as part of a thread to a related topic, but
did not receive a response so I thought of starting a new thread..]
I am using a FormView, Insert Template. I have 3 textboxes which are
bound. I would like to use a default (static) value in one of the
textboxes.
Here's the (relevant) sample code:
<InsertItemTemplate>
Stamp: <asp:TextBox ID="StampTextBox" runat="server"
Text='<%#Bind("fldStamp") %>'></asp:TextBox><br />
Again, what I would like to do is assign a default/static text "Canada"
to this textbox and bind it to fldStamp
I am fairly new at this and would appreciate your assistance and some
sample code.
Thanks
Shiraz 6 2730
Shiraz,
You have a contradiction in your request. To get a default text "Canada" you
need to write
<asp:TextBox ID="StampTextBox" runat="server" Text="Canada"/>
What do you mean by binding if it is already set to a static value? And what
is fldStamp?
Eliyahu
<sh***********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... [I posted this previously as part of a thread to a related topic, but did not receive a response so I thought of starting a new thread..]
I am using a FormView, Insert Template. I have 3 textboxes which are bound. I would like to use a default (static) value in one of the textboxes.
Here's the (relevant) sample code:
<InsertItemTemplate>
Stamp: <asp:TextBox ID="StampTextBox" runat="server" Text='<%#Bind("fldStamp") %>'></asp:TextBox><br />
Again, what I would like to do is assign a default/static text "Canada" to this textbox and bind it to fldStamp
I am fairly new at this and would appreciate your assistance and some sample code.
Thanks Shiraz
Hi Eliyahu
Thanks for your prompt response. What I meant was that I would like to
set the textbox field to "Canada" as you have inidicated correctly in
your code above. I would then like to have this text, on insert, bound
to the database field fldStamp.
Perhaps this will explain my issue:
Two Textboxes - one I would like to enter a value in and bind to the
database, the other I want to use a static value and bind to a
database:
The first is:
<asp:TextBox ID="TextBox1" runat="server"
Text='<%#Bind("fldTextBox") %>'></asp:TextBox><br />
The second:
<asp:TextBox ID="TextBox2" runat="server" Text="Canada"/>
like in the first example however, I would like this one with the
static text of "Canada" bound to the fldTextbox2 so that when I click
insert, it inserts the value entered in Textbox1 to fldTextbox1 and the
static value of Textbox2 (i.e., Canada) to fldTextbox2
Thanks
Shiraz
Shiraz,
Term "databinding" refers to cases when you link a web control property to a
datasource and it is used for setting properties. You need something else,
not databinding. You need to write a piece of code that will get the textbox
values, put them in a sql insert statement and execute the insert.
Eliyahu
"Shiraz" <sh***********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com... Hi Eliyahu
Thanks for your prompt response. What I meant was that I would like to set the textbox field to "Canada" as you have inidicated correctly in your code above. I would then like to have this text, on insert, bound to the database field fldStamp.
Perhaps this will explain my issue:
Two Textboxes - one I would like to enter a value in and bind to the database, the other I want to use a static value and bind to a database:
The first is:
<asp:TextBox ID="TextBox1" runat="server" Text='<%#Bind("fldTextBox") %>'></asp:TextBox><br />
The second:
<asp:TextBox ID="TextBox2" runat="server" Text="Canada"/> like in the first example however, I would like this one with the static text of "Canada" bound to the fldTextbox2 so that when I click insert, it inserts the value entered in Textbox1 to fldTextbox1 and the static value of Textbox2 (i.e., Canada) to fldTextbox2
Thanks Shiraz
I found this thread because I'm working with a similar issue. Isn't there some way to, in code, maybe in an event handler, set a value for a bound field? I have a formview with a bunch of fields the user will enter. One of the fields is the user's account and another is the current date, both of which are determined at runtime by code. I'd like to store these values as part of the record when the formview posts. I know how to put a value in the control using a page property, and I know how to bind a control, but I don't know how to get a computed value into the field which will then get stored to the db with the other formview data. I think this is some easy thing that I'm just making difficult. Anyone? I'm using .Net 2.0 Beta.
Thanks,
Will
From http://www.developmentnow.com/g/8_20...ox-Binding.htm
Posted via DevelopmentNow.com Groups http://www.developmentnow.com
Protected Sub FormView_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView.DataBound
Select Case Me.FormView.CurrentMode
Case FormViewMode.Insert
CType(Me.FormView.FindControl("fldStamp"), TextBox).Text = "Canada"
End Select
End Sub
[I posted this previously as part of a thread to a related topic, but
did not receive a response so I thought of starting a new thread..]
I am using a FormView, Insert Template. I have 3 textboxes which are
bound. I would like to use a default (static) value in one of the
textboxes.
Here's the (relevant) sample code:
<InsertItemTemplate>
Stamp: <asp:TextBox ID="StampTextBox" runat="server"
Text='<%#Bind("fldStamp") %>'></asp:TextBox><br />
Again, what I would like to do is assign a default/static text "Canada"
to this textbox and bind it to fldStamp
I am fairly new at this and would appreciate your assistance and some
sample code.
Thanks
Shiraz
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Paul Slavin |
last post by:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??
any answers appreciated, as to due to the underlying...
|
by: bardo |
last post by:
Does anyone knwo how I can bind a textbox to a single dataset/dataTable row?
The following will give me only a Column:
textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text",...
|
by: Alpha |
last post by:
I have several textboxes that I need to chang the text when the selection row
is changed in a datagrid. I have the following code. This textbox displayes
the initial selection but when I click on...
|
by: Aaron Smith |
last post by:
I found an quick and dirty example of a numeric text box that converts
the string to a currency mask.. Here is the code:
Public Class NumericMaskedTextBox
Inherits System.Windows.Forms.TextBox
...
|
by: simon |
last post by:
hello,
new to vb.net, have a few questions about DataGrid. I have a dataGrid
that is working pulling a dataset back from a stored proc and binding
to the datagrid for display
the datagrid's...
|
by: nvx |
last post by:
Hello everyone...
Just for the record, I'm a newbie to this data binding thing... In my
C# application I need to bind a cell of an Access database table to a
multiline TextBox. How should I do...
|
by: reidarT |
last post by:
I have a datagrid with columns. One of the columns are a textbox.
I want the text in this column shown in a textbox outside the datagrid.
How can I do that when clicking the actual row in the...
|
by: arun |
last post by:
Hi
How can I bind a textbox to current date in asp.net 2.0.
I want to achieve the same result that I will get when i am using
TextBox1.Text = System.DateTime.Now.ToString();
by binding in the...
|
by: Ken Varn |
last post by:
I have just started using VS.NET 2005 after using VS.NET 2003. One of the
things that I noticed is that in ASP.NET, the DataSource property for
TextBoxes and other web controls is no longer...
|
by: Dustin Davis |
last post by:
I've been having problems with databinding. I've created a simple
solution to emulate the problem I can't figure out. Basically, I have a
TextBox bound to a property in an object. When the property...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
| |