如何获取datalist里面子控件(如:dropdownlist)的值[WEB学习示例]

时间:2025-05-09 07:51:26

protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)//信息显示编辑与删除
    {
        pages = Request["page"];
        LinkButton LBut2 = (LinkButton)[0].FindControl("LinkButton2");
        LinkButton LBut3 = (LinkButton)[0].FindControl("LinkButton3");
        if (Session["UserName"] != null)
        {
            if ( == "BianJi_getID")
            {
                if (LBut2 != null) { strID = Convert.ToInt16(()).ToString(); }
                if ( != "") { Session["BaoChi"] = ; }
                ("Gong_Dan_List.aspx?&page=" + pages + "");
            }

            if ( == "ShuanChu_getID")
            {
                if (LBut3 != null) { strID = Convert.ToInt16(()).ToString(); }
                ShuanChu_JiLu();
            }
        }
        else
        { ("../"); }
    }

 

 

CheckBox chk = (CheckBox)[0].FindControl("CheckBox1");

 

Control shousuoKJ = (Control)("ContentPlaceHolder1");
        for (int Bi = 1; Bi <= 3; Bi++)
        { Button Bton = (Button)("Button" + ()); if (Bton != null) { = false; } }

 

LinkButton LBut3 = (LinkButton)[0].FindControl("LinkButton3");

----------------------------------------------------------------------------

<asp:LinkButton ID="LinkButton3" runat="server"
                                                                    CommandArgument='<%# (, "id")%>'
                                                                    CommandName="GuanLi_getID" Enabled="False" ToolTip="网站管理。">删除</asp:LinkButton>