2014年7月13日 星期日

[RESOLVED] Gridview with Calendar Controls as Select variables


I have the following piece of code that is populating a gridview based on 3 textboxes.  Two of the textboxes are calendar/date selectors.  when I run the query and manually populate the date values, I get data.  When I run the page and populates the values
using the calendar controls, I get nothing.  I have tried converting the values but with no luck.  What am I doing wrong??





























Text="Enter Glucose Value:">



 




Enabled="True" TargetControlID="TextBox2">


Control="TextBox2" Format="mm dd yyyy" AutoPostBack="False" />


 




Enabled="True" TargetControlID="TextBox3">


Control="TextBox3" Format="mm dd yyyy" AutoPostBack="False" />


 

 



 

 

 

 



ConnectionString="<%$ ConnectionStrings:sting%>" SelectCommand="select PersonID, EncounterID, FullName,
convert(varchar,AdmitDate,101),
convert(varchar,PerformDate,1), BG_Result
from
openquery (cerner, 'select distinct o.encntr_id EncounterID, p.person_id PersonID, e.arrive_dt_tm AdmitDate, p.name_full_formatted FullName, e.loc_nurse_unit_cd NurseUnit,
to_char(pr.perform_dt_tm,''mm/dd/yyyy hh24:mi:ss'') PerformDate,
pr.result_value_numeric BG_Result
from
orders o,
result r,
perform_result pr,
person p,
encounter e,
orders o2
where
o.active_ind = 1
and o.person_id = p.person_id
and o.encntr_id = e.encntr_id
and p.person_id = o2.person_id
and e.encntr_id = o2.encntr_id
and e.encntr_type_cd in (309308.00, 309312.00)
and pr.result_id = r.result_id
and o2.catalog_type_cd = 2516
and o2.catalog_cd in (5332977.00, 5332995.00, 5333001.00, 5333864.00, 5333263.00, 5333269.00, 5387492.00, 5350735.00,
5332983.00)
AND o.catalog_cd in (1165217.00, 656834.00, 3465881.00)
--and pr.result_value_numeric != 0.00
and pr.result_value_numeric < ''70''
and pr.result_value_numeric > ''0''
and o.orig_order_dt_tm >= ( sysdate - 30)
and r.order_id = o.order_id

')
where
performdate between convert(varchar,@startdate,1)
and convert(varchar,@enddate,1)
and convert(varchar,bg_result) < @result
order by FullName, convert(varchar,PerformDate,1) ">

PropertyName="Text" />
PropertyName="Text" />



CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333"
GridLines="None" DataKeyNames="EncounterID">


SortExpression="EncounterID">



SortExpression="FullName" >



SortExpression="Column1" >



SortExpression="Column2" >



SortExpression="BG_Result" >












 



I tried your code without the
RJS PopCalendar and it ran as expected.  Try commenting out the
RJS PopCalendar
 and see how it runs.



It looks like the calendar control is formatting the date like mm-dd-yyyy.  I try to change the format option on the control to mm/dd/yyyy and I get an error (object reference not set to an instance of an object).  I tried formatting the select variable
to mm/dd/yyyy but no luck.



Did you try setting the Separator?


   Control="TextBox3" Format="mm dd yyyy" AutoPostBack="False" Separator="/" />


 



Not sure how I missed that!  thanks!


 


沒有留言:

張貼留言