WEB开发网
开发学院WEB开发ASP.NET ASP.net下DataGrid的单项选择控件 阅读

ASP.net下DataGrid的单项选择控件

 2007-12-15 09:31:42 来源:WEB开发网   
核心提示:#region 声明//-- 作者: 李淼(Nick.Lee) ASP.net下DataGrid的单项选择控件// 时间:2005-3-15// boyorgril@msn.com// QQ:16503096//注意:引用请标明出处,谢谢//--#endregion前台:<%@ Control Language=

#region 声明
//----------------------------------------------------------------------
//
// 作者: 李淼(Nick.Lee)
//
// ASP.net下DataGrid的单项选择控件

// 时间:2005-3-15

// boyorgril@msn.com
// QQ:16503096
//注意:引用请标明出处,谢谢
//----------------------------------------------------------------------
#endregion

前台:

<%@ Control Language="c#" AutoEventWireup="false" Codebehind="WebUserControl1.ascx.cs" Inherits="message1.WebUserControl1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<LINK href="xpTable.css" type="text/css" rel="stylesheet">
<asp:DataGrid id="DataGrid1" runat="server" BorderStyle="None" BorderWidth="1px" CellPadding="4"
 Font-Size="9pt" Width="70%" BorderColor="#3366CC">
 <SelectedItemStyle Font-Bold="True" ForeColor="#CCFF99" BackColor="#009999"></SelectedItemStyle>
 <ItemStyle ForeColor="#003399" BackColor="White"></ItemStyle>
 <HeaderStyle Font-Bold="True" ForeColor="#CCCCFF" BackColor="#003399"></HeaderStyle>
 <FooterStyle ForeColor="#003399" BackColor="#99CCCC"></FooterStyle>
 <Columns>
 <asp:TemplateColumn>
  <ItemTemplate>
   <INPUT type=radio value='<%# DataBinder.Eval(Container.DataItem, "Volume")%>' name=RadioName>
  </ItemTemplate>
 </asp:TemplateColumn>
 </Columns>
 <PagerStyle HorizontalAlign="Left" ForeColor="#003399" BackColor="#99CCCC" Mode="NumericPages"></PagerStyle>
</asp:DataGrid>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button><INPUT id="rd" type="hidden" name="rd" runat="server">
<asp:Label id="Label1" runat="server">Label</asp:Label>

后台:

namespace message1
{
 using System;
 using System.Data;
 using System.Drawing;
 using System.Web;
 using System.Web.UI.WebControls;
 using System.Web.UI.HtmlControls;
 using System.Data.OleDb;
 using System.ComponentModel;

 using NickLee.Web.UI;

 /// <summary>
 /// WebUserControl1 的摘要说明。
 /// </summary>
 public class WebUserControl1 : System.Web.UI.UserControl
 {
 protected System.Web.UI.WebControls.DataGrid DataGrid1;
 protected System.Web.UI.HtmlControls.HtmlInputHidden rd;
 protected System.Web.UI.WebControls.Label Label1;
 public DataSet custDS = new DataSet();
 protected System.Web.UI.WebControls.Button Button1;

 private string sql;
 public string Sql
 {
  get{return sql;}
  set{sql=value;}
 }

 //------------------------------------------------------------------------------------
 /// <summary>
 /// 窗体名
 /// </summary>
 System.Web.UI.Page _page;
 [BrowsableAttribute(true),CategoryAttribute("Appearance"),BindableAttribute(true)]

Tags:ASP net DataGrid

编辑录入:coldstar [复制链接] [打 印]
赞助商链接