Knowledge Base
Search form the holds state
Last Post 01 Jan 1900 12:00 AM by . 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Angus BeareUser is Offline
Veteran Member
Veteran Member
Posts:753
Avatar

--
18 Sep 2009 11:32 AM  
I wanted a search filter that passes parameters to the URL and then refreshes the page but also maintains the fields the user has selected.

I did this by setting the controls to the url params on load. It has one drop down and one text box. I created a template to go underneath that takes the parameters and passes them to an SP.

Here is the code.

<addForm ClientName="SearchDocuments">


<script type="text/javascript">
function GoTo()
{

var txtDocType = document.getElementById(SearchDocuments.ddlDocumentType);
var txtString = document.getElementById(SearchDocuments.txtString);

// Build the new Querystring URL
var strlocation ="/Advocacy/AgricultureFoodcommittee/Meetingeventdocuments/tabid/143/Default.aspx" + "?dt=" + txtDocType.value + "&st=" + txtString.value;

// uncomment to check the string
// alert(strlocation);
window.location.href=strlocation;

}
function GoDefaults()
{

window.location.href="/Advocacy/AgricultureFoodcommittee/Meetingeventdocuments/tabid/143/Default.aspx";

}
</script>


<SelectCommand CommandText="SELECT @dt AS DocumentTypeID, @st as stText">
<parameter name="dt" value='[[Url:dt]]' />
<parameter name="st" value='[[Url:st]]' />
</SelectCommand>


<controldatasource id="dsDocumentTypes" commandtext="select DocumentTypeID,DocumentType from digitalink_documenttypes" />


<table cellpadding="5" cellspacing="5"><tbody>
<tr>
<td><strong>Document Type:</strong></td>
<td><strong>Title Text:</strong></td>
</tr>
<tr>
<td align="left">
<dropdownlist id="ddlDocumentType" DataSourceID="dsDocumentTypes" DataField="DocumentTypeID" DataValueField="DocumentTypeID" DataTextField="DocumentType" datatype="int32" AppendDataBoundItems="true">
<listitem value="0">Default</listitem>
</dropdownlist>
</td>

<td align="left">
<textbox id="txtString" datafield="stText" datatype="string" />
</td>
</tr>
<tr>
<td align="left">
<div class="longer_gold_button">
<a href="javascript:GoTo()" class="longer_gold_button">Search</a>
</div>
</td>

<td align="right">
<div class="longer_gold_button">
<a href="javascript:GoDefaults()" class="longer_gold_button">Show default list</a>
</div>
</td>
</tr>
</tbody></table>
</addForm>
if the only tool you have is a hammer you tend to see every problem as a nail.. http://www.carawaydesign.com
You are not authorized to post a reply.

Active Forums 4.1
spacer
dummy