Click here to Skip to main content
15,884,893 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello Guys

Here is my problem I have a careers page in my website I want the user to be able to search for jobs using some filters the filters parameters is coming from database and they are binded like this

job type binded in radiobuttonlist

department binded in listbox

hours binded in dropdownlist


I cant get the values choosen by the user to pass it to my other page.

I tried to pass static values to see if it work and it did

VB
<asp:ImageButton ID="ImageButton1" runat="server" Height="27px" ImageUrl="~/images/search-bt.png" Width="64px" CausesValidation="False" EnableViewState="False" onclick="ImageButton1_Click" PostBackUrl="~/Careers_Search_results.aspx?type=Pharmacist&hours=Full-Time&department=Sales %26 Marketing" />


can anyone please help me to get them dynamically as the user choose them?

thanks in advance
:-)
Posted
Updated 27-Apr-11 2:39am
v2

Save the values as session variables, or pass them in the querystring to the page in question.
 
Share this answer
 
Comments
a1mimo 27-Apr-11 7:41am    
thank you,
but how to pass them in the querystring can you give me an example
a1mimo 27-Apr-11 9:41am    
Thank You I got it :-)
One way is to put the values into the Session object and then read those fro the other page. You can wire up the OnClick event of the button and do something like:

C#
protected void ImageButton1_Click(object sender, EventArgs e)
{
    System.Web.HttpContext.Current.Session.Add("Key", "Value");
    Response.Redirect("~/Careers_Search_results.aspx");
}


You can then get these values in the OnLoad event of the other page with:

C#
protected override void OnLoad(EventArgs e)
{
    if (!IsPostBack)
    {
        string data = System.Web.HttpContext.Current.Session["Key"].ToString();
    }
}


That should get you started.
 
Share this answer
 
Comments
a1mimo 27-Apr-11 7:45am    
thanks alot for your answer I know it really works but I have a problem I am still fixing in the onclick event so I cant use it but its a great answer anyway thanks again :-)


my vote of 5
a1mimo 27-Apr-11 9:41am    
Thank You I got it :-)

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