I am building a search project. I have one combobox and two dateinputs and when I submit a form to populate the result I dont want the data in the combobox and dateinputs to disappear.
I got this help from Kelly:
Since this solution involves a "redirect" back to the same page, your values will disappear. You can re-populate them. In your search for, add a <SelectCommand> tag that grabs those values from the URL or Form <SelectCommand CommandText="SELECT @uid AS UserID">
<Parameter Name="uid" Value='[[Form:userid]]' DataType="Int32" /> (or [[Url:userid]] if you're using the GET RedirectMethod).
This will pre-fill your search box with the value from the form.
I tried this and it works fine if I dont use JQuery. If I use JQuery (see code below) all the controls are cleard on submit.
Here is my form:
<AddForm Clientname="FerdatorgLeit" Ajax="True">
<ScriptBlock BlockType="HeadScript" RegisterOnce="True" ScriptId="KBXM_Theme_ui-pepper-grinder/jquery-ui-1.7.2.custom.css_frmFerdatorgLeit">
<link rel="stylesheet" type="text/css" href="/DesktopModules/XModPro/styles/ui-pepper-grinder/jquery-ui-1.7.2.custom.css" />
</ScriptBlock>
<ScriptBlock ScriptId="mask" BlockType="HeadScript">
<script type="text/javascript" src="/js/jquery_maskedinput.js"> </script>
</ScriptBlock>
<ControlDataSource Id="dsFerdategund" ConnectionString="MyConnStr" CommandText="SELECT [ID], [TripTypeName] FROM [TripTypes] ORDER BY [TripTypeName] ASC">
</ControlDataSource>
<SelectCommand CommandText="SELECT @ID AS ID, @Dagsfra as Dagsfra, @DagsTil as DagsTil">
<Parameter Name="ID" Value='[[Url:ID]]' DataType="Int32" />
<Parameter Name="Dagsfra" Value='[[Url:DagsFra]]' DataType="Int32" />
<Parameter Name="DagsTil" Value='[[Url:DagsTil]]' DataType="Int32" />
</SelectCommand>
<div>
<Label For="ddlFerdategund" Text="Ferðategund"> </Label>
</div>
<div>
<DropDownList Id="ddlFerdategund" DataField="ID" DataSourceId="dsFerdategund" DataTextField="TripTypeName" DataValueField="ID" AppendDataBoundItems="True">
</DropDownList>
</div>
<div>
<Label For="DagsFra" Text="Dags frá"> </Label>
</div>
<div>
<DateInput Id="DagsFra" DataField="Dagsfra" DataType="Date" Nullable="True" width="150px"/>
</div>
<div>
<Label For="DagsTil" Text="Dags til"> </Label>
</div>
<div>
<DateInput Id="DagsTil" DataField="DagsTil" DataType="Date" Nullable="True" width="150px"/>
</div>
</br>
<AddButton Text="Leita" Redirect="/Heim/Ferdatorg.aspx?iTripType=[[ID]]&DagsFra=[[DagsFra]]&DagsTil=[[DagsTil]]" RedirectMethod="GET" />
<jQueryReady>
$("#" + FerdatorgLeit.DagsFra).datepicker({
dateFormat: 'dd.mm.yy'}
);
</jQueryReady>
<jQueryReady>
$("#" + FerdatorgLeit.DagsTil).datepicker({
dateFormat: 'dd.mm.yy'}
);
</jQueryReady>
<jQueryReady>
$("#" + FerdatorgLeit.DagsFra).mask("99.99.9999");
</jQueryReady>
<jQueryReady>
$("#" + FerdatorgLeit.DagsTil).mask("99.99.9999");
</jQueryReady>
</AddForm>