dpc:Creating a DataBound List of Radio Buttons--预览
来源:互联网 发布:sjf调度算法 编辑:程序博客网 时间:2024/05/16 12:45
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<% @Import Namespace="System.Data.SqlClient" %>
<script language="vb" runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
If Not Page.IsPostBack then
BindData()
End If
End Sub
Sub BindData()
'1. Create a connection
Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
'2. Create the command object, passing in the SQL string
Const strSQL as String = "SELECT PublisherID, Name FROM tblPublishers ORDER BY Name"
Dim myCommand as New SqlCommand(strSQL, myConnection)
myConnection.Open()
radlstPubs.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
radlstPubs.DataBind()
End Sub
Sub btnViewBooks_Click(sender as Object, e as EventArgs)
'If the user has not selected an item from the Radiobuttonof.com" target=_blank>List,
'do nothing
If radlstPubs.SelectedItem Is Nothing then Exit Sub
'1. Create a connection
Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
'2. Create the command object, passing in the SQL string
Dim strSQL as String = "SELECT Title, Description FROM tblBooks " & _
" WHERE PublisherID = " & radlstPubs.SelectedItem.Value & _
" ORDER BY Title"
Dim myCommand as New SqlCommand(strSQL, myConnection)
myConnection.Open()
dgBooks.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
dgBooks.DataBind()
lblTitle.Text = "Books Published by " & radlstPubs.SelectedItem.Text
End Sub
</script>
<html>
<body>
<h1>Radio Button of.com" target=_blank>List Demo</h1>
This demo illustrates how to use data-binding to dynamically
create a Radio button of.com" target=_blank>List based on database information.
The data below is from the
<a href="http://www.4guysfromrolla.com/webtech/chapters/">Sample Chapters Database</a>.
First, the Radio button of.com" target=_blank>List is bound to the <code>tblPublishers</code> table. Then,
when you select a publisher, a DataGrid Web control is populated with
the books provided by the selected publisher. (Adding paging to the DataGrid would be
a snap. Just read: <a href="http://www.4guysfromrolla.com/webtech/072101-1.shtml">Paing
Database Results in ASP.NET</a>!)
<p><hr><p>
<form runat="server">
<b>Choose a Publisher's Books to View</b><br>
<asp:Radiobuttonof.com" target=_blank>List id="radlstPubs" runat="server" Font-Name="Verdana"
DataValueField="PublisherID" DataTextField="Name" />
<br>
<asp:button id="btnViewBooks" runat="server" Font-Name="Verdana"
Text="View Published Books" OnClick="btnViewBooks_Click" />
<p align="center">
<asp:label id="lblTitle" runat="server" Font-Name="Verdana"
Font-Size="Large" Font-Bold="True" />
<asp:datagrid id="dgBooks" runat="server"
Font-Name="Verdana" Font-Size="Smaller"
HeaderStyle-BackColor="Purple" HeaderStyle-ForeColor="White"
HeaderStyle-Font-Size="Small" HeaderStyle-Font-Bold="True"
AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn HeaderText="Book Title" HeaderStyle-HorizontalAlign="Center"
DataField="Title" />
<asp:BoundColumn HeaderText="Synopsis" HeaderStyle-HorizontalAlign="Center"
DataField="Description" />
</Columns>
</asp:datagrid>
</p>
</form> <
of.com" target=_blank>dpc:of.com" target=_blank>Creating a of.com" target=_blank>DataBound of.com" target=_blank>List of Radio Buttons--预览页面source code[等级:中]';return true">
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<% @Import Namespace="System.Data" %><% @Import Namespace="System.Data.SqlClient" %>
<script language="vb" runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
If Not Page.IsPostBack then
BindData()
End If
End Sub
Sub BindData()
'1. Create a connection
Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
'2. Create the command object, passing in the SQL string
Const strSQL as String = "SELECT PublisherID, Name FROM tblPublishers ORDER BY Name"
Dim myCommand as New SqlCommand(strSQL, myConnection)
myConnection.Open()
radlstPubs.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
radlstPubs.DataBind()
End Sub
Sub btnViewBooks_Click(sender as Object, e as EventArgs)
'If the user has not selected an item from the Radiobuttonof.com" target=_blank>List,
'do nothing
If radlstPubs.SelectedItem Is Nothing then Exit Sub
'1. Create a connection
Dim myConnection as New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
'2. Create the command object, passing in the SQL string
Dim strSQL as String = "SELECT Title, Description FROM tblBooks " & _
" WHERE PublisherID = " & radlstPubs.SelectedItem.Value & _
" ORDER BY Title"
Dim myCommand as New SqlCommand(strSQL, myConnection)
myConnection.Open()
dgBooks.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
dgBooks.DataBind()
lblTitle.Text = "Books Published by " & radlstPubs.SelectedItem.Text
End Sub
</script>
<html>
<body>
<h1>Radio Button of.com" target=_blank>List Demo</h1>
This demo illustrates how to use data-binding to dynamically
create a Radio button of.com" target=_blank>List based on database information.
The data below is from the
<a href="http://www.4guysfromrolla.com/webtech/chapters/">Sample Chapters Database</a>.
First, the Radio button of.com" target=_blank>List is bound to the <code>tblPublishers</code> table. Then,
when you select a publisher, a DataGrid Web control is populated with
the books provided by the selected publisher. (Adding paging to the DataGrid would be
a snap. Just read: <a href="http://www.4guysfromrolla.com/webtech/072101-1.shtml">Paing
Database Results in ASP.NET</a>!)
<p><hr><p>
<form runat="server">
<b>Choose a Publisher's Books to View</b><br>
<asp:Radiobuttonof.com" target=_blank>List id="radlstPubs" runat="server" Font-Name="Verdana"
DataValueField="PublisherID" DataTextField="Name" />
<br>
<asp:button id="btnViewBooks" runat="server" Font-Name="Verdana"
Text="View Published Books" OnClick="btnViewBooks_Click" />
<p align="center">
<asp:label id="lblTitle" runat="server" Font-Name="Verdana"
Font-Size="Large" Font-Bold="True" />
<asp:datagrid id="dgBooks" runat="server"
Font-Name="Verdana" Font-Size="Smaller"
HeaderStyle-BackColor="Purple" HeaderStyle-ForeColor="White"
HeaderStyle-Font-Size="Small" HeaderStyle-Font-Bold="True"
AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn HeaderText="Book Title" HeaderStyle-HorizontalAlign="Center"
DataField="Title" />
<asp:BoundColumn HeaderText="Synopsis" HeaderStyle-HorizontalAlign="Center"
DataField="Description" />
</Columns>
</asp:datagrid>
</p>
</form> <
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- dpc:Creating a DataBound List of Radio Buttons--预览
- DPC:Creating a DataBound List of Radio Buttons--PA
- DPC: Creating a multicolumn Dropdownlist[等级:初 中]
- Radio Buttons
- Radio Buttons
- Creating a radio button item renderer on a Spark List control in Flex 4
- Creating CSS Buttons
- Creating Round SysMenu Buttons
- Radio buttons and GroupBox
- android - Radio Buttons
- SQL: A example of creating a procedure
- CREATING ROUND SWING BUTTONS 2
- Creating Sencha Touch Toolbar Buttons
- 1200057 - When creating or refreshing a Crystal Report from a BW query, the list of available SAP sy
- Creating a Custom SharePoint 2007 List Definition
- Radio buttons vs. combo box
- WPF Tips: Uncheckable radio buttons
- Android API Guides---Radio Buttons
- DPC:Creating a DataBound List of Radio Buttons--PA
- 转: ASP.NET高级应用 (3)
- 一个个人网页自动化生成系统(3)
- 如何操作注册表
- 桌面中心(三) 修改数据库
- dpc:Creating a DataBound List of Radio Buttons--预览
- 桌面中心(二) 数据库写入
- 在 Visual C# .NET 中建立一个平滑的进度条
- 桌面中心(一) 创建数据库
- DPC: Creating a multicolumn Dropdownlist[等级:初 中]
- PHP 留言簿(带Oracle数据库分页的显示功能)
- C#如何打开关闭CDROM
- 一个广告轮播系统的例子(内含文件上传的方法)
- DPC:Hiding Columns In A DataGrid[等级:初 中]