I'm going to do this page now, and then I use the DataList control to display the title, and I want to ask how to bind the title of my database tutorial to the DataList control, and then let it show the exam questions?
Workaround 1:
DataList DataBind ()
Workaround 2:
View detailed information on MSDN
Workaround 3:
Use table tables in DataList templates, such as: <asp Tutorials: DataList id= "Dldetailedinfo" runat= "Server" onitemdatabound= "Dldetailedinfo_ ItemDataBound "
Width= "100%" >
<ItemTemplate>
<table width= "100%" border= "0" cellpadding= "0" cellspacing= "0" class= "Tablebtitle" >
<tr>
<th colspan= "2" scope= "col" >
Xingyang find a job on the Xingyang talent Network or Xingyang Life network </th>
</tr>
<tr>
<TD width= "25%" class= "Tablegrayright" >
Mining Machinery Encyclopedia network can be Free Inquiry ball mill and other mining equipment capital </td>
<TD class= "Tablenoneleft" >
<asp:label id= "Lbltypename" runat= "server" text= ' <%# Eval ("TypeName")%> ' ></asp:Label>
</td><!--Zhengzhou To do the site to find a new Fulcrum network </tr>
</table>
</ItemTemplate>
</asp:DataList>
Workaround 4:
The text of your control uses <%# Eval ("title Field name")%>
For example: txext= ' <%# Eval ("title")%> '
Bind Paging Implementation
The Dlbind method is a custom no return value type method that is used primarily to query a record from a database for a specified condition and bind to a DataList control, and then by setting the AllowPaging property of the PagedDataSource class object to True, To implement the paging functionality of the DataList control. The Dlbind method implements the code as follows:
public void Dlbind ()
{
int curpage = Convert.ToInt32 (This.labPage.Text);
PagedDataSource PS Tutorial = new PagedDataSource ();
Sqlcon = new SqlConnection (Strcon);
Sqlcon. Open ();
String sqlstr = "Select a.*,b.* from Tb_card as a join Tb_module as B on A.moduleid=b.moduleid";
SqlDataAdapter myadapter = new SqlDataAdapter (Sqlstr, Sqlcon);
DataSet ds = new DataSet ();
Myadapter.fill (ds, "Tb_card");
Ps. DataSource = ds. tables["Tb_card"]. DefaultView;
Ps. AllowPaging = true; Whether you can page pagination
Ps. PageSize = 2; Number of Displays
Ps. CurrentPageIndex = curpage-1; Get the page number of the current page
This.lnkbtnUp.Enabled = true;
This.lnkbtnNext.Enabled = true;
This.lnkbtnBack.Enabled = true;
This.lnkbtnOne.Enabled = true;
if (curpage = 1)
{
this.lnkbtnOne.Enabled = false;//does not display the first page button
this.lnkbtnUp.Enabled = false;//does not display the previous page button
}
if (Curpage = PS. PageCount)
{
this.lnkbtnNext.Enabled = false;//does not display next page
this.lnkbtnBack.Enabled = false;//does not display the last page
}
This.labBackPage.Text = Convert.ToString (PS. PageCount);
This.dlContent.DataSource = PS;
This.dlContent.DataKeyField = "Cardid";
This.dlContent.DataBind ();
Sqlcon. Close ();
}