FormView Questions

Discussion in 'ASP .Net' started by Q. John Chen, Nov 9, 2006.

  1. Q. John Chen

    Q. John Chen Guest

    I have a table T with following columns for example
    ID, ParentID, ApptDateTime, UpdatedBy

    On formView I want display the ApptDate and Time seperately with two
    textBoxes.

    In itemTemplate, I can do this:
    Text='<%# Eval("ApptDateTime", "{0:MM/dd/yyyy}") %>' (for date
    part)
    Text='<%# Eval("ApptDateTime", "{0:HH:mm}") %>' (for
    time part)
    I set the textboxes Readonly so user can not change the values.

    In insertTemplate, I can do this:
    Text='<%# Bind("ApptDate") %>' (for date part)
    Text='<%# Bind("ApptTime") %>' (for time part)

    I am using ObjectDataSource. I can add code to combine the values in
    the InsertMethod.
    But how can bind the
    ParentID with is key in GridView
    and
    UpdateBy which I can get from the user credential.

    In editTemplate, What do I do in this situation? Do I have to change
    the SQL so the date and time is already seperated,
    i.e. "Selete ApptDateTime as ApptDate, ApptDateTime as ApptTime ..." in
    SQL

    Thanks

    John

    display the apptDate and Time seperatly like "11/9/2006 at 10:00".

    in editTemplate and insertTemplate, I want show two textboxes,
    ApptDateTextBox and ApptTimeTextBox.
     
    Q. John Chen, Nov 9, 2006
    #1
    1. Advertising

  2. Q. John Chen

    Q. John Chen Guest

    For ParentID and UpdatedBy, I figured out:
    in ItemInserting event, add them to the e.Values collection.

    Q. John Chen wrote:
    > I have a table T with following columns for example
    > ID, ParentID, ApptDateTime, UpdatedBy
    >
    > On formView I want display the ApptDate and Time seperately with two
    > textBoxes.
    >
    > In itemTemplate, I can do this:
    > Text='<%# Eval("ApptDateTime", "{0:MM/dd/yyyy}") %>' (for date
    > part)
    > Text='<%# Eval("ApptDateTime", "{0:HH:mm}") %>' (for
    > time part)
    > I set the textboxes Readonly so user can not change the values.
    >
    > In insertTemplate, I can do this:
    > Text='<%# Bind("ApptDate") %>' (for date part)
    > Text='<%# Bind("ApptTime") %>' (for time part)
    >
    > I am using ObjectDataSource. I can add code to combine the values in
    > the InsertMethod.
    > But how can bind the
    > ParentID with is key in GridView
    > and
    > UpdateBy which I can get from the user credential.
    >
    > In editTemplate, What do I do in this situation? Do I have to change
    > the SQL so the date and time is already seperated,
    > i.e. "Selete ApptDateTime as ApptDate, ApptDateTime as ApptTime ..." in
    > SQL
    >
    > Thanks
    >
    > John
    >
     
    Q. John Chen, Nov 9, 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. Kelly

    DataSource and FormView questions

    Kelly, Aug 8, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    4,846
    Kelly
    Aug 9, 2006
  2. Chris

    Formview within Formview

    Chris, May 19, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    574
    Chris
    May 19, 2007
  3. dan
    Replies:
    2
    Views:
    1,103
  4. Jeronimo Bertran

    .net 2.0 FormView questions

    Jeronimo Bertran, Oct 20, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    6
    Views:
    200
    Steven Cheng[MSFT]
    Oct 25, 2005
  5. David Thielen

    FormView/Repeater/ Eval(FormView data)

    David Thielen, Jun 16, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    697
    David Thielen
    Jun 16, 2006
Loading...

Share This Page