如何获取菜单项值 [英] how to getting menu item value

查看:81
本文介绍了如何获取菜单项值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过xml datasource绑定菜单控制表单数据库(sql server)表。但是当我选择菜单项时,我需要获取该菜单项值并显示在page.how中这样做



请分享解决方案。

i bind the menu control form database(sql server) table through xml datasource.but when i select the menu item I need to get that menu item value and display in the page.how to do like this

Please share the solutions.

推荐答案

public static void dropdownbind1(string tbl, string field, DropDownList ddl, string datatext, string datatvale)
   {
       ddl.Items.Clear();
       str = "select distinct " + field + " from " + tbl + ""
       cmd = new MySqlCommand(str, Classmysql.con);
       dtp = new MySqlDataAdapter(cmd);
       ds = new DataSet();
       dtp.Fill(ds);
       if (ds.Tables[0].Rows.Count > 0)
       {
           ddl.DataSource = ds;
           ddl.DataTextField = datatext;
           ddl.DataValueField = datatvale;
           ddl.DataBind();
           ddl.Items.Insert(0, "SELECT");
       }
       else
       {
           ddl.Items.Insert(0, "no details");

       }
here is the example.it is general method.

   }


这篇关于如何获取菜单项值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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