ASP.NET动态HTML对象名称

时间:2016-05-03 22:06:57

标签: c# asp.net variables dynamic objectname

我需要在此代码中使用动态'变量'名称。你能救我吗?

像这样的“Html对象id.ToString();”

    public static void ddl(string sorgu,object ad)
    {
        using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["vtbag"].ConnectionString))
        {
            cnn.Open();
            using (SqlCommand cmd = new SqlCommand(sorgu, cnn))
            {
                using(SqlDataAdapter bakadp = new SqlDataAdapter(sorgu, cnn))
                {
                    using (DataTable baktbl = new DataTable())
                    {// Here is my problem
                        bakadp.Fill(baktbl);
                        html object id.DataSource = baktbl;
                        html object id.DataTextField = "ad";
                        html object id.DataValueField = "id";
                        html object id.DataBind();
                    }// End
               }
           }
     }

0 个答案:

没有答案