且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在网格视图中绑定下拉列表中的值

更新时间:2022-11-08 13:23:14

尝试级联下拉菜单-
http://www.dotnetcurry.com/ShowArticle.aspx?ID=221 [ ^ ]
http://www.dotnetfunda.com/forums/thread2916-cascading-dropdown-in- gridview.aspx [ ^ ]
Try cascading dropdowns -
http://www.dotnetcurry.com/ShowArticle.aspx?ID=221[^]
http://www.dotnetfunda.com/forums/thread2916-cascading-dropdown-in-gridview.aspx[^]


对于子SubCategory,您必须传递CategoryID作为参数并将此args传递给您的sqlString

for the sub SubCategory u have to pass CategoryID as argument and pass this args to your sqlString

private DataSet subcategory(string Cat)
    {
        string ConnectionString = Convert.ToString(System.Configuration.ConfigurationManager.ConnectionStrings["Db_Connection"]);
        MySqlConnection con = new MySqlConnection(ConnectionString);
        string querry = "select SubCategoryId ,SubCategoryName from ravishankar_ivrs_subcategory where CategoryId='"+Cat+"'" +;
        MySqlCommand cmd = new MySqlCommand(querry, con);
        con.Open();
 
        MySqlDataAdapter ad = new MySqlDataAdapter(cmd);
        con.Close();
 
        DataSet dt = new DataSet();


 
        ad.Fill(dt);
 
        return dt;
 
    }




和相同的ForProduct实现到SubCat.


您也可以签出.
http://forums.asp.net/t/1333162.aspx/1 [ ^ ]

http://www.aspnettutorials.com/tutorials/controls/dropdownlist-gridview-csharp.aspx [^ ]

http://***.com/questions/2422140/making-gridview- response-to-2-drop-down-lists [ ^ ]




and the same ForProduct Realated To SubCat.


You can Checkout This Also.
http://forums.asp.net/t/1333162.aspx/1[^]

http://www.aspnettutorials.com/tutorials/controls/dropdownlist-gridview-csharp.aspx[^]

http://***.com/questions/2422140/making-gridview-respond-to-2-drop-down-lists[^]