Link to home
Start Free TrialLog in
Avatar of krypto2000
krypto2000

asked on

Use the Databinding event to change the value

Hi,

I use a calendar popup to choose a date in my form.
I bind the SelectedDate properties to show the date from database.

Then my poroblem is : When is null value I want to change the binded value to 1.1.1900

What is the way to intercept the binded value and change it ?

I try to find something around the DataBinding event but didn't find anthing...

Thanks for your help !
Avatar of djhex
djhex

Show me your code I think you must retrieve the information with sqldatareader and then use the property isdbnull of the datareader.
Avatar of krypto2000

ASKER

<ew:CalendarPopup id="CalendarPopup5"
   SelectedDate='<%# DataBinder.Eval(dsWarranty1, "Tables[tb_sav_warranty].DefaultView.[0].wty_estimate_validate_date") %>'>

and after on the onLoad event :

daWarranty.SelectCommand.Parameters["@hdr_index"].Value = (string)Session["hdr_index"];
daWarranty.Fill(dsWarranty1);      

CalendarPopup5.DataBind();

that's it !

but when there is a null value , it raise an convertion error.. I think this control don't accept null value so if I can transform to 1.1.1900 it's great for me ...

thanks
First DOnt use dataset.
Second if you use the embedded databinder.eval you dont have a way to control for null values. You must make a method to retrieve it programatically. It seems that you are using the dataset designer.

there is not a way to intercept the value like the ItemDataBound property of the datagrid and change it ??
Is this from a stored proc?

If so, why not just return 1/1/1900 in the query?


Select IsNull(SomeDateField, "1/1/1900") From tablename
No with the calendar.

And why are u using typed datasets? its one of the worst practices for real developers. You should make it all by hand
so okay djhex, what do I have to use, DataView ?
I just use dataSet because I can use it in the IDE to DataBind my controls...
ASKER CERTIFIED SOLUTION
Avatar of djhex
djhex

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i'll try monday now it's week.end ;-)
ok.
I'd say points to djhex.