Click here to Skip to main content
14,266,139 members
Rate this:
Please Sign up or sign in to 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

<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
Rate this:
Please Sign up or sign in to vote.

Solution 1

Save the values as session variables, or pass them in the querystring to the page in question.
   
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 :-)
Rate this:
Please Sign up or sign in to vote.

Solution 2

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:

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:

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


That should get you started.
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100