FormView Questions

  • Thread starter Thread starter Q. John Chen
  • Start date Start date
Q

Q. John Chen

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.
 
For ParentID and UpdatedBy, I figured out:
in ItemInserting event, add them to the e.Values collection.
 
Back
Top