Click here to Skip to main content
15,904,287 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys,

XML
<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



C#
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 am 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 query string it creates a problem

please tell me way out.
Posted
Updated 5-Mar-11 0:19am
v3
Comments
Sandeep Mewara 5-Mar-11 6:25am    
You need to elaborate more on this:
but I am 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 query string it creates a problem
I doubt this as + or - should not hamper with query string.

For your requirement just replace the '+' with any other character. Check the sample
C#
Response.Redirect("search_donor.aspx?bg=" + DropDownList2.SelectedItem.Text.Replace('+', '/') + "&st=" + DropDownList3.SelectedItem.Text + "&city=" + DropDownList1.SelectedItem.Text);

//Retrieve the value like
string str=Request.QueryString["bg"].ToString().Replace('/','+');
 
Share this answer
 
Comments
Albin Abel 5-Mar-11 10:14am    
This should work. My 5
m@dhu 5-Mar-11 13:15pm    
Thanks Albin.
or you can use
<a href="http://msdn.microsoft.com/en-us/library/6196h3wt.aspx" target="_balnk">Server.UrlDecode(string s)<br />
</a>


100:rose: ;)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900