homepage Welcome to WebmasterWorld Guest from 54.237.54.83
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Setting Date Filter on Grid
Component Art Grid Date Filter
slick




msg:3711400
 5:48 pm on Jul 30, 2008 (gmt 0)

Hello everyone,

I am working on an AJAX Component Art grid and I have a seperate search bar on top with 5 filters. 3 of them being dropdown lists, one a textbox and one a textbox with a small calender icon next to it to select a date. All filters are working except the date textbox with the small calender. Below is my javascript client side script for filtering:

[codes]
function CandidateSub_Search()
{
var filter = "";

if (document.all.<%=txtName.ClientID%>.value != '')
{
filter = "FullCandidateName LIKE '%" + document.all.<%=txtName.ClientID%>.value + "%'"
}

//if status is not selected return all values i.e. %
if (document.all.<%=ddlStatus.ClientID%>.options[document.all.<%=ddlStatus.ClientID%>.selectedIndex].value != '%')
{
//add AND to append to the previous filter
if (filter.length > 0)
{
filter = filter + " AND "
}

filter = filter + "StatusID = " + document.all.<%=ddlStatus.ClientID%>.options[document.all.<%=ddlStatus.ClientID%>.selectedIndex].value
}

if (document.all.<%=ddlPractice.ClientID%>.options[document.all.<%=ddlPractice.ClientID%>.selectedIndex].value != '%')
{
//add AND to append to the previous filter
if (filter.length > 0)
{
filter = filter + " AND "
}

filter = filter + "PracticeID = " + document.all.<%=ddlPractice.ClientID%>.options[document.all.<%=ddlPractice.ClientID%>.selectedIndex].value
}

if (document.all.<%=ddlProcessingStatus.ClientID%>.options[document.all.<%=ddlProcessingStatus.ClientID%>.selectedIndex].value != '%')
{
//add AND to append to the previous filter
if (filter.length > 0)
{
filter = filter + " AND "
}

filter = filter + "ProcessingStatusID = " + document.all.<%=ddlProcessingStatus.ClientID%>.options[document.all.<%=ddlProcessingStatus.ClientID%>.selectedIndex].value
}

if (document.all.<%=txtDateSubmitted.ClientID%>.value!='')
{

if (filter.length > 0)
{
filter = filter + " AND "
}
filter = filter + "LastUpdated >= " + document.all.<%=txtDateSubmitted.ClientID%>.value;
}

alert(filter);
CandidateSubmissionGrid.filter(filter);
}
[/codes]

Basically, my "LastUpdated" column in the DB is a date column with dates for the last update. Basically, I want to put in a date in the textbox (or choose from the calender) and when I click on search, I want it to show all records in the grid after the date I entered into the textbox. Hopefully i'm clear in all this. The last filter is the one for dates...and for clearer reading purposes, i'll paste it down below again.

if (filter.length > 0)
{
filter = filter + " AND "
}
filter = filter + "LastUpdated >= " + document.all.<%=txtDateSubmitted.ClientID%>.value;
}

Any input or help would be highly appreciated. Thank you in advance.

Regards,
S

 

Arno_Adams




msg:3711893
 8:49 am on Jul 31, 2008 (gmt 0)

Hi,
'document.all' isn't x-browser. Try replacing with document.getElementById.

Also what datatype is 'LastUpdated' in your DB?

HTH, Tom

slick




msg:3712025
 1:31 pm on Jul 31, 2008 (gmt 0)

LastUpdated is datatype "Datetime". What do you mean that it isn't x-browser? I'm not very familiar with Javascript. Thanks..

Arno_Adams




msg:3712878
 12:06 pm on Aug 1, 2008 (gmt 0)

document.all is only supported by IE. Try using document.getElementById('<%=txtDateSubmitted.ClientID%>').value
instead.

HTH, Tom

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved