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

我的程序 | 2009-11-24 19:28:59 | 阅读 945 次 | 评论(0)

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

            if (e.CommandName == "ShuanChu_getID")
            {
                if (LBut3 != null) { strID = Convert.ToInt16(e.CommandArgument.ToString()).ToString(); }
                ShuanChu_JiLu();
            }
        }
        else
        { Response.Redirect("../default.aspx"); }
    }

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

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

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

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

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

文章评论,共0条
游客请输入验证码