如何使用C#读取详细信息视图中的行 [英] How Do I read Row In A Details View using C#
本文介绍了如何使用C#读取详细信息视图中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
美好的一天所有,我有这个小问题
Good Day All, I have this little issue
// On Page Load
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px"
Width="100%" AutoGenerateRows="False" DataKeyNames="StaffID" ForeColor="#333333" GridLines="None" CellPadding="4"
DataSourceID="SqlDataSource1">
<Fields>
<asp:BoundField DataField="StaffOrder" HeaderText="Staff Order"
SortExpression="StaffOrder" InsertVisible="False" ReadOnly="True" />
<asp:BoundField DataField="Title" HeaderText="Question" SortExpression="Title" />
<asp:BoundField DataField="FullName" HeaderText="FullName"
SortExpression="Name" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:MySqlLocalSqlServer %>"
SelectCommand="SELECT * FROM [Staff] ORDER BY [StaffOrder]">
</asp:SqlDataSource>
protected void NextButton_Click(object sender, EventArgs e)
{
System.Data.DataRowView dr = (System.Data.DataRowView)DetailsView1.DataItem;
if(DetailsView1.PageIndex == DetailsView1.PageCount - 1)
{
NextButton.Text = "Finished";
}
else
{
DetailsView1.PageIndex++;
//Once the next button is clicked, i want to display the StaffOrder and Staff Name in a Label... How Do i achieve this please.. Thanks For your time
}
推荐答案
ConnectionStrings:MySqlLocalSqlServer%>
SelectCommand = SELECT * FROM [工作人员] ORDER BY [StaffOrder] >
< / asp:SqlDataSource >
< span class =code-keyword> protected void NextButton_Click( object sender,EventArgs e )
{
System.Data.DataRowView dr =(System.Data.DataRowView)DetailsView1.DataItem;
if (DetailsView1.PageIndex == DetailsView1.PageCount - 1 )
{
NextButton。 Text = 已完成;
}
else
{
DetailsView1.PageIndex ++;
// 点击下一个按钮后,我想显示StaffOrder和员工姓名在标签...我如何实现这一目标...感谢您的时间
}
ConnectionStrings:MySqlLocalSqlServer %>" SelectCommand="SELECT * FROM [Staff] ORDER BY [StaffOrder]"> </asp:SqlDataSource> protected void NextButton_Click(object sender, EventArgs e) { System.Data.DataRowView dr = (System.Data.DataRowView)DetailsView1.DataItem; if(DetailsView1.PageIndex == DetailsView1.PageCount - 1) { NextButton.Text = "Finished"; } else { DetailsView1.PageIndex++; //Once the next button is clicked, i want to display the StaffOrder and Staff Name in a Label... How Do i achieve this please.. Thanks For your time }
这篇关于如何使用C#读取详细信息视图中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文