看演示:
http://61.149.141.167/test/WebForm6.aspx
代码如下:
————————————————————————————
.aspx
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm6.aspx.vb" Inherits="test.WebForm6"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm6</title>
<meta content="Microsoft Visual Studio .NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<link rel="stylesheet" href="s1.css" type="text/css">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:datagrid id="dg1" CssClass="datagrid" style="Z-INDEX: 101; LEFT: 102px; POSITION: absolute; TOP: 92px" runat="server">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:RadioButton Runat="server" ID="r1" AutoPostBack="True" Text="TColumn"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 308px; POSITION: absolute; TOP: 50px" runat="server">Label</asp:label></form>
</body>
</HTML>
_______________________
.aspx.vb
Public Class WebForm6
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents dg1 As System.Web.UI.WebControls.DataGrid#Region " Web 窗体设计器生成的代码 " '该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub#End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IsPostBack = False Then
Label1.Text = ""
loaddata()
End If
End Sub
Sub loaddata()
Dim OleDbConnection1 As System.Data.OleDb.OleDbConnection
Dim OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter
Dim objtable As DataTable
Dim strcmd As String
Dim strconn As String
Dim i As Integer
Dim objLink As New DataSet()
strconn = "Provider=SQLOLEDB.1;User ID=xx;pwd=xx;datasource=freeme;Initial Catalog=test;"
strcmd = "select * from utp "
OleDbConnection1 = New System.Data.OleDb.OleDbConnection(strconn)
OleDbDataAdapter1 = New System.Data.OleDb.OleDbDataAdapter(strcmd, OleDbConnection1)
OleDbDataAdapter1.Fill(objLink, "utp")
objtable = objLink.Tables("utp") '首天的查询
OleDbConnection1.Close()
dg1.DataSource = objtable.DefaultView
dg1.DataBind()
End Sub
Sub oc(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim DGI As DataGridItem
Dim rb As RadioButton
Dim tempr, temprt As String For Each DGI In dg1.Items
rb = DGI.FindControl("r1")
If rb.Checked Then
tempr = rb.ClientID
If Label1.Text = "" Then
rb.Checked = True
temprt = tempr
Else
If tempr <> Label1.Text Then
rb.Checked = True
temprt = tempr
'Response.Write("选中不同行:" + tempr + ":" + Label1.Text + "<br>")
End If
If tempr = Label1.Text Then
'Response.Write("选中同行:" + tempr + ":" + Label1.Text + "<br>")
rb.Checked = False
End If
End If
End If
Next
Label1.Text = temprt
End Sub Private Sub dg1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg1.ItemDataBound
If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then
Dim nl As New Label()
nl.Text = "<INPUT type='radio' name='r3' text='样式生成'>"
e.Item.Cells(0).Controls.Add(nl)
End If
End Sub
End Class
______________________________
这里面是2种添加的方法
http://61.149.141.167/test/WebForm6.aspx
代码如下:
————————————————————————————
.aspx
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm6.aspx.vb" Inherits="test.WebForm6"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm6</title>
<meta content="Microsoft Visual Studio .NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<link rel="stylesheet" href="s1.css" type="text/css">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:datagrid id="dg1" CssClass="datagrid" style="Z-INDEX: 101; LEFT: 102px; POSITION: absolute; TOP: 92px" runat="server">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:RadioButton Runat="server" ID="r1" AutoPostBack="True" Text="TColumn"></asp:RadioButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid><asp:label id="Label1" style="Z-INDEX: 102; LEFT: 308px; POSITION: absolute; TOP: 50px" runat="server">Label</asp:label></form>
</body>
</HTML>
_______________________
.aspx.vb
Public Class WebForm6
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents dg1 As System.Web.UI.WebControls.DataGrid#Region " Web 窗体设计器生成的代码 " '该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub#End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IsPostBack = False Then
Label1.Text = ""
loaddata()
End If
End Sub
Sub loaddata()
Dim OleDbConnection1 As System.Data.OleDb.OleDbConnection
Dim OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter
Dim objtable As DataTable
Dim strcmd As String
Dim strconn As String
Dim i As Integer
Dim objLink As New DataSet()
strconn = "Provider=SQLOLEDB.1;User ID=xx;pwd=xx;datasource=freeme;Initial Catalog=test;"
strcmd = "select * from utp "
OleDbConnection1 = New System.Data.OleDb.OleDbConnection(strconn)
OleDbDataAdapter1 = New System.Data.OleDb.OleDbDataAdapter(strcmd, OleDbConnection1)
OleDbDataAdapter1.Fill(objLink, "utp")
objtable = objLink.Tables("utp") '首天的查询
OleDbConnection1.Close()
dg1.DataSource = objtable.DefaultView
dg1.DataBind()
End Sub
Sub oc(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim DGI As DataGridItem
Dim rb As RadioButton
Dim tempr, temprt As String For Each DGI In dg1.Items
rb = DGI.FindControl("r1")
If rb.Checked Then
tempr = rb.ClientID
If Label1.Text = "" Then
rb.Checked = True
temprt = tempr
Else
If tempr <> Label1.Text Then
rb.Checked = True
temprt = tempr
'Response.Write("选中不同行:" + tempr + ":" + Label1.Text + "<br>")
End If
If tempr = Label1.Text Then
'Response.Write("选中同行:" + tempr + ":" + Label1.Text + "<br>")
rb.Checked = False
End If
End If
End If
Next
Label1.Text = temprt
End Sub Private Sub dg1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg1.ItemDataBound
If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <> ListItemType.Footer Then
Dim nl As New Label()
nl.Text = "<INPUT type='radio' name='r3' text='样式生成'>"
e.Item.Cells(0).Controls.Add(nl)
End If
End Sub
End Class
______________________________
这里面是2种添加的方法
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货