problem with querystring

Posted by Sarbjeet6706 under ASP.NET on 3/5/2011 | Points: 10 | Views : 1569 | Status : [Member] | Replies : 4
hi guys,

<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList2" runat="server" Width="165px">
<asp:ListItem>[Select Group]</asp:ListItem>
<asp:ListItem>A+ </asp:ListItem>
<asp:ListItem>B+ </asp:ListItem>
<asp:ListItem>AB+ </asp:ListItem>
<asp:ListItem>O+ </asp:ListItem>
<asp:ListItem>A-</asp:ListItem>
<asp:ListItem>B-</asp:ListItem>
<asp:ListItem>AB-</asp:ListItem>
<asp:ListItem>O-</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DropDownList3" runat="server" Width="167px">
<asp:ListItem>Jammu Kashmir</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DropDownList1" runat="server" Width="167px">
<asp:ListItem>Jammu</asp:ListItem>
<asp:ListItem>Srinagar</asp:ListItem>
</asp:DropDownList>

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Search" Width="88px" /><br />
<br />
</div>
</form>
</body>


code behind is like this



using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class search : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{

Response.Redirect ("search_donor.aspx?bg=" + DropDownList2.SelectedItem.Text + "&st=" + DropDownList3.SelectedItem.Text + "&city=" + DropDownList1.SelectedItem.Text);

}
}


but i m not getting the results in the grid view where i pass these querystrings

i think this is because of A+,A-,AB+ when we pass it in querystring it creates a problem

plz tell me way out,,,,

sarbjeet Singh


Responses

Posted by: Vuyiswamb on: 3/5/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
How do you retrieve them on the other side ?


Thank you for posting at Dotnetfunda
[Administrator]

Sarbjeet6706, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 3/5/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

You can do one thing... Just concatenate all the string values into a single string and pass as query string to the other page... In the other page at page load again remove the values and then use it to bind...

Thanks
Karthik
www.f5Debug.net

Sarbjeet6706, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gsolvers on: 3/5/2011 [Member] Starter | Points: 25

Up
0
Down
Did you try using HTML Encoding/Decoding. This might help

Best Regards,

VG
www.TeacherJi.com

Sarbjeet6706, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 3/6/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Best thing would be to create a structure or an class entity object containing all these values that you want to pass to next page thru query string and collect there and use it as needed.



Thanks and Regards
Madhu

Sarbjeet6706, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response