基于多个下拉列表控件重定向到网页。 [英] Redirecting to webpage based on multiple dropdownlist controls.

查看:69
本文介绍了基于多个下拉列表控件重定向到网页。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友,



我有医院1(H1),住院2(H2),医院3(H3)在ddl1和急诊(E),帐户(A) ,一般(G)在ddl2



我想去所有组合H1E,H1A,H1G,H2E,H2A,H2G,H3E,H3A,H3G每个项目是一个

的网页,选择下拉控件。



我该怎么做?



plz帮帮我。





谢谢,

Kranthi

Hi Friends,

I have hospital1(H1), hospital2(H2) , hospital3(H3) in ddl1 and emergency(E),accounts (A),general (G) in ddl2

I want to go for all combinations H1E,H1A,H1G,H2E,H2A,H2G, H3E,H3A,H3G each item is a
webpage by selecting dropdown controls.

How do i do that?

plz help me.


Thanks,
Kranthi

推荐答案

这个想法是这样的,连接2个下拉列表中的选定值来组成重定向的页面名称:

按钮点击

The idea goes like this, concatenate the selected values from the 2 dropdownlists to make up the redirected page name:
on button click
string hospital = ddl1.SelectedItem.Value;   // e.g. "H1" 
string type = ddl2.SelectedItem.Value;        // e.g. "E" 
string para = "http://sitename/" + hospital + type;   // e.g. "H1E"
Response.Redirect(para);



参考:使用c#将数据绑定到下拉列表 [ ^ ]


您可以直接在按钮内单击或者你选择了 DropDowwnLists 后的东西。

You can directly do that inside the Button Click or something after you select both the DropDowwnLists.
protected void Button Click(object sender, EventArgs e)
{
    RedirectToAPageRelatedToDropDownSelectedValues(ddl1.SelectedValue, dd2.SelectedValue);
    // I assume the DropDown values are same as texts.
}

private void RedirectToAPageRelatedToDropDownSelectedValues(DropDown1SelectedValue, DropDown2SelectedValue)
{
    if(DropDown1SelectedValue.Equals("H1") && DropDown2SelectedValue.Equals("E"))
    {
        // Do whatever you want.
    }
    else if(DropDown1SelectedValue.Equals("H1") && DropDown2SelectedValue.Equals("E"))
    {
        // Do whatever you want.
    }
    // Write for all the combinations.
}


这篇关于基于多个下拉列表控件重定向到网页。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆