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 !
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 !
Show me your code I think you must retrieve the information with sqldatareader and then use the property isdbnull of the datareader.
ASKER
<ew:CalendarPopup id="CalendarPopup5"
SelectedDate='<%# DataBinder.Eval(dsWarranty 1, "Tables[tb_sav_warranty].D efaultView .[0].wty_e stimate_va lidate_dat e") %>'>
and after on the onLoad event :
daWarranty.SelectCommand.P arameters[ "@hdr_inde x"].Value = (string)Session["hdr_index "];
daWarranty.Fill(dsWarranty 1);
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
SelectedDate='<%# DataBinder.Eval(dsWarranty
and after on the onLoad event :
daWarranty.SelectCommand.P
daWarranty.Fill(dsWarranty
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.
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.
ASKER
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
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
And why are u using typed datasets? its one of the worst practices for real developers. You should make it all by hand
ASKER
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...
I just use dataSet because I can use it in the IDE to DataBind my controls...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i'll try monday now it's week.end ;-)
ok.
I'd say points to djhex.