HomeHomeDotNetNuke Forg...DotNetNuke Forg...Module ForumsModule ForumsReportsReportsGenerate report based on query string + AJAX + Employee directoryGenerate report based on query string + AJAX + Employee directory
Previous
 
Next
New Post
8/11/2010 4:36 AM
 

Hi All,

First of all a big thank for all your support and developments on DNN.


I have set up an intranet site with DNN. I now need to add an Employee directory to it.

The idea is that I have an SQL table populated with data from the Active Directory. I can use the reports module to search my employee using a parameter as a query string.

Here is the query:
SELECT 
                * 
FROM
                Staging.dbo.STGEmployee 
WHERE
                EmployeeFirstName like '%'  + @url_Par + '% 
                OR EmployeeLastName like '%'  + @url_Par + '%'

This is working fine.

Now I want to go a step further and reproduce somehow the functionality of Efforty User Directory module: I want to fire that query on each input char in a text box and display the list of employee accordingly.

So here are my questions
1 - How to fire the query from a text box for input and a send button all that in the same page
2 - How to make this in an update panel on the same page so I don’t have to refresh the whole page?
3 - How to make this work on input key without send button?

Many thanks for your suggestions.

Aurélien

 
New Post
8/11/2010 1:21 PM
 
Hello, this is typically done via using an autocomplete ajax element (e.g. one from the ajax toolkit) - http://www.adefwebserver.com/dotnetnukehelp/Misc/Dotnetnuke_AJAX_ControlToolkit.htm is a nice resource for this. As the changes will fire server events you typically wire up the event (e.g. the textchanged event of the textbox) to fire the query that provides the grid data. As to how to get an update panel, DotNetNuke has a supports partial rendering checkbox (that can be set in the dnn manifest also ) -http://www.datasprings.com/Resources/ArticlesInformation/AJAXwDotNetNuke.aspx
 
New Post
8/13/2010 10:31 AM
 
Hi thanks for your return.



For information I did the following on my DNN 5 site:

1 - Add a HTML module to the page. in this module I put a textbox:

Title<input type="texte" id="QueryStg" OnKeyUp="QueryEmployee()" />

Then I had some javascript code to:
a-set the text box value to the value entered before postback
b-build url to call report module with the queryString

<body onload="getQueryString()">
<script language="JavaScript">
function getQueryString(){
document.getElementById("QueryStg").value = gup('par');
document.getElementById("QueryStg").focus();
}

function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}

function QueryEmployee(){
var obj = document.getElementById("QueryStg");
var form = document.getElementById("Form");
var url = "http://mysite.corp/intranet/test.aspx?par=" + obj.value;
form.action=url;
form.submit();
}

function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars[QueryStg];
}
</script>


2 - Add the report module set up to select data based on the par parameter in the url

At this point I have to reload the page on every key up.

Is there a way to add an update panel for both HTML and Reports modules? The idea is to avoid pure dev as much as possible and find a free solution.

Many thanks,
 
New Post
8/13/2010 6:18 PM
 
you can go and edit the module definitions for the individual module controls (via host->module definitions) and set "support partial rendering". Please note, I do not advise this for html as it will break file uploads (which can't occur under ajax) - it may also effect the report module but I've not tested this.
 
Previous
 
Next
HomeHomeDotNetNuke Forg...DotNetNuke Forg...Module ForumsModule ForumsReportsReportsGenerate report based on query string + AJAX + Employee directoryGenerate report based on query string + AJAX + Employee directory


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Start  Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.