3

I am working on a single page asp.net application(webform) with 4 dropdowns.

Please take this example http://ifsccode.in

I need the same functionality in my website.The coding part is done.Everything is working fine but I want to display the dropdown selected item in the URL same as the above example.

I would like to tell you that I have created only one page application.

So please tell me how to achieve the Dropdown selected item in URL.

Ram Singh
  • 6,664
  • 35
  • 100
  • 166
  • Without seeing your code it's hard to answer you. Having looked at your example, it might be as simple as each item in the drop down directs to the appropriate URL. – Tim Oct 11 '12 at 08:00
  • Do you still have the problem if any of our answers has solve your problem then dont miss to accept it – Ram Singh Oct 11 '12 at 08:56
  • Take in consideration to accept an answer that was most helpful. The green checkmark you put next to the 'accepted' answer will reward the Answerer, and show other users which was the correct one. – Roko C. Buljan Feb 09 '13 at 08:05

3 Answers3

1

This page uses URL Rewriting. Actually the resulting URL is not generated by user selecting and option, but the url is allready there. Look at this link.

"/development_credit_bank_limited/daman_diu" is responding to a get request and displaying the page according to that request and parameters.

So what you have to do is first implement URL Rewriting in your application and then design your pages to use that convention.

Yiğit Yener
  • 5,796
  • 1
  • 23
  • 26
0

Use QueryString like if I choose Emad from ddlEmployees in /Employee.aspx page then the url will be like this /Employee.aspx?Employee=Emad and redirect to the new url.

Emad Mokhtar
  • 3,237
  • 5
  • 31
  • 49
0

try this code following code

 protected void Page_Load(object sender, EventArgs e)
{
    if (!string.IsNullOrEmpty(Request.QueryString["u"]))
    {
        // bind second dropdown with first's selected value
    }
    if (!string.IsNullOrEmpty(Request.QueryString["u"]) && !string.IsNullOrEmpty(Request.QueryString["m"]))
    {
        // bind third dropdown with first's selected value and second's selected value
    }
    if (!string.IsNullOrEmpty(Request.QueryString["u"]) && !string.IsNullOrEmpty(Request.QueryString["m"]) && !string.IsNullOrEmpty(Request.QueryString["n"]))
    {
        // bind Details
    }
}

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    Response.Redirect("Default.aspx?id=" + DropDownList1.SelectedItem.Value + "");
}

protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
    String url = Request.RawUrl;
    Response.Redirect(url + "&m=" + DropDownList2.SelectedItem.Value + "");
}
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
    String url = Request.RawUrl;
    Response.Redirect(url + "&n=" + DropDownList3.SelectedItem.Value + "");
}

And do url rewritting also for this concept ..... I hope this will work for you......................

Ram Singh
  • 6,664
  • 35
  • 100
  • 166