[原创]ASP.net下DataGrid的单项选择控件

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

// 时间:2005-3-15

// [email protected]
// QQ:16503096
//注意:引用请标明出处,谢谢
//----------------------------------------------------------------------
#endregion

前台:

1@ Control Language="c#" AutoEventWireup="false" Codebehind="WebUserControl1.ascx.cs" Inherits="message1.WebUserControl1" TargetSchema=" http://schemas.microsoft.com/intellisense/ie5"% >

<link href="xpTable.css" rel="stylesheet" type="text/css"/>

<asp:datagrid bordercolor="#3366CC" borderstyle="None" borderwidth="1px" cellpadding="4" font-size="9pt" id="DataGrid1" runat="server" width="70%"> <selecteditemstyle backcolor="#009999" font-bold="True" forecolor="#CCFF99"></selecteditemstyle> <itemstyle backcolor="White" forecolor="#003399"></itemstyle> <headerstyle backcolor="#003399" font-bold="True" forecolor="#CCCCFF"></headerstyle> <footerstyle backcolor="#99CCCC" forecolor="#003399"></footerstyle> <columns> <asp:templatecolumn> <itemtemplate>
 <input name="RadioName" type="radio" value='&lt;%# DataBinder.Eval(Container.DataItem, "Volume")

1</itemtemplate>
2</asp:templatecolumn>
3</columns>
4<pagerstyle backcolor="#99CCCC" forecolor="#003399" horizontalalign="Left" mode="NumericPages"></pagerstyle>
5</asp:datagrid>
1<asp:button id="Button1" runat="server" text="Button"></asp:button>
1<input id="rd" name="rd" runat="server" type="hidden"/>
1<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;

///

1<summary>   
2/// WebUserControl1 的摘要说明。   
3/// </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;}
}

//------------------------------------------------------------------------------------
///

1<summary>   
2/// 窗体名   
3/// </summary>

System.Web.UI.Page _page;
[BrowsableAttribute(true),CategoryAttribute("Appearance"),BindableAttribute(true)]
public System.Web.UI.Page page
{
get
{
return _page;
}
set
{
_page=value;
}
}

private void Page_Load(object sender, System.EventArgs e)
{
string js = "";
// js+="

1<script></script>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus