Problem in validate 4 Controls in runtime...

legendgod

Regular
Joined
May 17, 2004
Messages
53
Location
Hong Kong
Dear Xtremers,

I have 4 dropdownlist controls which let users to select the task Starttime and endtime:

There is a datagrid which have 2 controls in each of the editItemtemplate. They are (in editItemTemplate A:) StartTimeHrDDL, StartTimeMinDDL & (in editItemTemplate B:) EndTimeHrDDL, EndTimeMinDDL. And because these controls are created in runtime. I place the validator control in the end of editItemTemplate B too.

I found no problem when compare EndTimeHrDDL with StartTimeHrDDL (I want to make sure EndTime should not be lesser then StartTime). However, I want to perform the same validation to the StartTimeMinDDL & EndTimeMinDDL ONLY if StartTimeHrDDL = EndTimeHrDDL.

Because I cannot write a if..else statement in the runtime (if it is possible, please teach me!), I try to call a function like <%# GetResult() %> to get the result of the validation between StartTimeHrDDL & EndTimeHrDDL but fail.

Could anyone give me some idea? Thanks
 
This validation could easily be done on the client-side.
My idea is to use Javascript (or VBScript) to make a client validation. It's time so it's easily "decryptable" by Javascript and since it's DDL... user won't mess up everything.

Go with Javascript
 
However since it is a edit/update/cancel datagrid, the dropdownlist will be generated only in runtime. How to apply Javascript?

May I ask another question here: how to call a Javascript function in aspx function? And vice versa?

Thank you.
 
Back
Top