<div dir=ltr>// Page1.aspx -- In Button Click Event Write this code..</div> <div dir=ltr>protected void Button1_Click(object sender, EventArgs e)
{
DateTime d1 = Calendar1.SelectedDate; // ID Of Calendar 1 is Calendar1
DateTime d2 = Calendar2.SelectedDate; // ID Of Calendar 2 is Calendar2</div> <div dir=ltr> Response.Write(d1.ToShortDateString() + d2.ToShortDateString());</div> <div dir=ltr>
TimeSpan ts = d2 - d1; // Gives the Difference between two dates.</div> <div dir=ltr> int days = ts.Days; // Days Part Of timespan
Response.Redirect("Page2.aspx?No_Of_Days="+days.ToString()+""); //Call Page2.aspx with parameters No_Of_Days
}</div> <div dir=ltr>
//Page2.aspx -- In Page Load Event write this code..</div> <div dir=ltr>protected void Page_Load(object sender, EventArgs e)
{ string noofdays = Request.QueryString["No_Of_Days"]; // Get the Parameter NO_Of_days from Page1.aspx</div> <div dir=ltr> int days = Convert.ToInt16(noofdays); // Conversion From String To Integer</div> <div dir=ltr> days
= days + 1; // Total Days Of Leave = noOfdays+1;</div> <div dir=ltr> Response.Write("Number Of Days= " + days); // Output the days in page2.aspx
chandu2chand...
Participant
1158 Points
261 Posts
Re: request.querystring
Feb 27, 2008 01:14 PM|LINK
Hi,
string sTest = Request.QueryString["showBtn1"];
The second u wrote is the right form of query string. If u post the Url which contains the query string then I can give the better solution for u.
Regards,
Chandu
[Albert Einstein]
Regards,
Chandu
tje.gaab
Member
30 Points
46 Posts
Re: request.querystring
Feb 28, 2008 05:08 AM|LINK
Hi,
My hyperlink is made like this...
<
asp:Hyperlink Text='Add Customer'style="font-size: 8pt; color: #cb0022;"
runat="server" id="AddCustomer"
Font-Size="Small"
NavigateUrl="~/Customer.aspx?showBtn1=12345"
onClick="window.open('Customer.aspx','_blank','height=200,width=415,toolbar=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=no');return false" Height="12px"Width="84px" /><span style="font-size: 8pt"></span>
//Thomas
Punithkumar
Contributor
5192 Points
918 Posts
Re: request.querystring
Feb 28, 2008 05:23 AM|LINK
{
DateTime d1 = Calendar1.SelectedDate; // ID Of Calendar 1 is Calendar1
DateTime d2 = Calendar2.SelectedDate; // ID Of Calendar 2 is Calendar2</div> <div dir=ltr> Response.Write(d1.ToShortDateString() + d2.ToShortDateString());</div> <div dir=ltr> TimeSpan ts = d2 - d1; // Gives the Difference between two dates.</div> <div dir=ltr> int days = ts.Days; // Days Part Of timespan
Response.Redirect("Page2.aspx?No_Of_Days="+days.ToString()+""); //Call Page2.aspx with parameters No_Of_Days
}</div> <div dir=ltr>
//Page2.aspx -- In Page Load Event write this code..</div> <div dir=ltr>protected void Page_Load(object sender, EventArgs e)
{
string noofdays = Request.QueryString["No_Of_Days"]; // Get the Parameter NO_Of_days from Page1.aspx</div> <div dir=ltr> int days = Convert.ToInt16(noofdays); // Conversion From String To Integer</div> <div dir=ltr> days = days + 1; // Total Days Of Leave = noOfdays+1;</div> <div dir=ltr> Response.Write("Number Of Days= " + days); // Output the days in page2.aspx
}</div>
Punithkumar
chandu2chand...
Participant
1158 Points
261 Posts
Re: request.querystring
Feb 28, 2008 05:44 AM|LINK
Hi,
when click on u r hyper link it just follows the link Customer.aspx which is in the onClick property's window.open function. U can change that as
window.open('Customer.aspx?showBtn1=12345'.....
Regards,
Chandu
[Albert Einstein]
Regards,
Chandu
tje.gaab
Member
30 Points
46 Posts
Re: request.querystring
Feb 28, 2008 06:59 AM|LINK
Thanks Chandu.
Now it works.
What exactly does the 'NavigateUrl'? If I delete it the link still works, but on the page it does not appear as a link (undelined).
Well... Thanks again :)
//Thomas
chandu2chand...
Participant
1158 Points
261 Posts
Re: request.querystring
Feb 28, 2008 07:06 AM|LINK
Welcome
Please dont forgot to mark as Answer if my answer worked.
Regards,
Chandu
[Albert Einstein]
Regards,
Chandu