代码改变世界

随笔分类 -  Asp.net

验证控件验证DropDownList

2011-12-07 10:24 by 鹏雕, 270 阅读, 收藏,
摘要: <tr> <tdclass="caption td_caption"> 免疫程序:</td> <tdclass="txtbox td_textbox"> <asp:DropDownListID="ddlMYCX"runat="server"Width="200px"AutoPostBack="true"AppendDataBoundItems="true"OnSelectedIndexChanged=& 阅读全文

GridView中显示bool字段(在数据库中是字符类型)

2011-12-06 09:42 by 鹏雕, 496 阅读, 收藏,
摘要: 法一:<asp:BoundField DataField="是否启用" HeaderText="是否启用"> <ItemStyle Width="15%" HorizontalAlign="Center" /></asp:BoundField> if (ds != null && ds.Tables[0].Rows.Count > 0) // 进行数据绑定前的示意转换 { for (int i = 0; i < ds.Tables[0].Rows.Co 阅读全文

GridView 的空模板使用方法

2011-11-01 19:20 by 鹏雕, 323 阅读, 收藏,
摘要: 当GridView绑定的数据源为Null或查询绑定的DataSet等为空时GridView显示没有数据的提示有如下几种方式一是用GridView的EmptyDataText-------------------------------<asp:GridView ID="gv_Info" runat="server" CssClass="GridView" EditRowStyle-HorizontalAlign="center" AutoGenerateColumns="True" All 阅读全文

GridView动态添加模板列

2011-10-10 14:56 by 鹏雕, 433 阅读, 收藏,
摘要: 首先,第一步,创建一个类MyTemplate.cspublic class MyTemplate:ITemplate{ private string strColumnName; private DataControlRowType dcrtColumnType; public MyTemplate() { // // TODO: 在此处添加构造函数逻辑 // } /// <summary> /// 动态添加模版列 /// </summary> /// <param name="strColumnName">列名</param> 阅读全文

asp.net页如何获取母版页控件

2011-10-09 13:11 by 鹏雕, 478 阅读, 收藏,
摘要: 获取母版页的相关内容有两种方法1 通过findcontrol找控件ID需要在此事件中~因为Page_load中时是先内容页加载然后才是母版页加载 protected void Page_LoadComplete(object sender, EventArgs e) { Label2.Text = "现在时间是" + (Master.FindControl("Label1") as Label).Text; if (Request.QueryString["id"] == "dy") { (Master.FindC 阅读全文

updatepanel中的GridView中的radiobuttonList怎么设置样式

2011-09-27 11:47 by 鹏雕, 313 阅读, 收藏,
摘要: 步骤:1:在单选按钮组控件中 添加属性 RepeatLayout ,其值选“flow”<asp:RadioButtonList ID="rblcellstat" runat="server" Width="240px" RepeatDirection="Horizontal" RepeatLayout="flow">(说明:选“flow”,RadioButtonList控件在网页中显示为<span></span>形式,若选“table”,在网页中显示<t 阅读全文