Bind TextBox!

Discussion in 'ASP .Net' started by Adam J Knight, Jan 12, 2006.

  1. Hi all,

    I am assuming there may be a number of ways to bind a text box to a db field
    using c#.

    My current approach is: txtPostCode.Text =
    rdrInstitution["PostCode"].ToString();

    Can anyone let me if there is a generally accepted method for databinding a
    textbox using c#.

    Cheers,
    Adam
     
    Adam J Knight, Jan 12, 2006
    #1
    1. Advertising

  2. Unless your in a databound control (repeater/grid/list/view), that's
    generally the way it's done.

    Some of us have an actual business layer, so you'd never see a datareader in
    your presentation layer, you'd do

    txtPostCode.Text = userAddress.PostalCode;

    but that's another disucssion..

    Karl

    --
    http://www.openmymind.net/



    "Adam J Knight" <> wrote in message
    news:%...
    > Hi all,
    >
    > I am assuming there may be a number of ways to bind a text box to a db
    > field using c#.
    >
    > My current approach is: txtPostCode.Text =
    > rdrInstitution["PostCode"].ToString();
    >
    > Can anyone let me if there is a generally accepted method for databinding
    > a textbox using c#.
    >
    > Cheers,
    > Adam
    >
     
    Karl Seguin [MVP], Jan 12, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan Davenport via .NET 247

    Bind optional one-to-one relationship to textbox

    Dan Davenport via .NET 247, Aug 4, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    634
    Dan Davenport via .NET 247
    Aug 4, 2004
  2. Vijaya
    Replies:
    2
    Views:
    2,650
    Vijaya
    Nov 13, 2003
  3. =?Utf-8?B?TXJNaWtl?=

    Bind Textbox to DataSet

    =?Utf-8?B?TXJNaWtl?=, Jan 24, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    29,297
    =?Utf-8?B?TXJNaWtl?=
    Jan 25, 2005
  4. mr2_93
    Replies:
    1
    Views:
    3,600
    mr2_93
    Oct 2, 2005
  5. Replies:
    0
    Views:
    591
Loading...

Share This Page