I want to redirect to another page and pass some parameters only using javascript. I am not supposed to use query string. Is there any way to achieve this? I am working on asp.net.
I want this redirection to use with devexpress scheduler control where when a user clicks on an appointment, the user be redirected to another page by passing the selected appointment's ID as parameter. It should not be passed as query string.
I would also like to know how to retrieve such kind of invisible parameter from the redirected page.
Ok I found out my solution.
I used javascript to click a <asp:Button>
that is set to style="display:none"
. In my scenario, I could get the properties of scheduler appointment that I had clicked. I then put these properties in hidden fields and in the server side click event of this 'invisible' button, I use these hidden field values to make my redirection through server side. My code is as below
<asp:Button ID="Appointment" runat="server" Text="sample"
onclick="Appointment_Click" style="display:none"/>
<asp:HiddenField ID="hfID" runat="server" />
<asp:HiddenField ID="hfSubject" runat="server" />
<asp:HiddenField ID="hfDate" runat="server" />
<script type="text/javascript" language="javascript">
function OnAppointmentClick(s, e) {
//debugger;
var apt = scheduler.GetAppointmentById(e.appointmentId);
var apt1 = scheduler.GetAppointmentProperties(e.appointmentId);
var aptID = document.getElementById('<%= hfID.ClientID %>');
var aptDate = document.getElementById('<%= hfDate.ClientID %>');
var aptSubject = document.getElementById('<%= hfSubject.ClientID %>');
aptID.value = e.appointmentId;
var date = (apt.startDate.getMonth()+1) + '/' + apt.startDate.getDate() + '/' + apt.startDate.getYear();
aptDate.value = date;
aptSubject.value = apt.CODE;
document.getElementById('<%= Appointment.ClientID %>').click();
}
</script>