关于下拉框获取选择 [英] Regarding Dropdown box get Selected

查看:88
本文介绍了关于下拉框获取选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个名为GAL.aspx的页面,我有一个下拉框,它有3个部门,即Mechanical,CSE,EEE。每个下拉列表都会显示一些从中选择的图片下拉菜单。





我在名为CSEgal,EEEgal,Mechangal的三个子菜单的主页中给出了一个菜单栏,所以点击这个子菜单CSEgal它应该进入GAL.aspx页面并选择Dropdown CSE。



所以请告诉我如何链接和编码。

Hi there,
I have page named GAL.aspx in that i have a dropdown box in that it have 3 departments namely Mechanical,CSE,EEE.Each dropdown will display some pictures whlie selected from the dropdown.


I have a menubar as given in the masterpage in that three submenus named CSEgal ,EEEgal , Mechanicalgal so while clicking this submenu CSEgal it should go to the GAL.aspx page and get selected the Dropdown CSE.

So please tell me how to link and code for it.

推荐答案

在菜单部分为所有三个添加查询字符串



对于机械子菜单GAL.aspx?GALOption = Mechanical

对于CSE子菜单GAL.aspx?GALOption = CSE

对于EEE子菜单GAL.aspx?GALOption = EEE



在pageload中添加以下代码



Add Querystring for all three in menu section

For mechanical submenu "GAL.aspx?GALOption=Mechanical"
For CSE submenu "GAL.aspx?GALOption=CSE"
For EEE submenu "GAL.aspx?GALOption=EEE"

Add below code in pageload

if (!IsPostBack)
        {
            if (Request.QueryString["GALOption"] != null)
            {
                if (Request.QueryString["GALOption"].ToString() != "Mechanical")
                {

                    ddlCategory.Items.FindByText("Mechanical").Selected = true;
                }
                else if (Request.QueryString["GALOption"].ToString() != "CSE")
                {
                    ddlCategory.Items.FindByText("CSE").Selected = true;
                }
                else if (Request.QueryString["GALOption"].ToString() != "EEE")
                {
                    ddlCategory.Items.FindByText("EEE").Selected = true;
                }
            }
        }


这篇关于关于下拉框获取选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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