Workaround 1:
DataList DataBind ()
Workaround 2:
View detailed information on MSDN
Workaround 3:
Use a table table in the DataList template, such as:
Copy Code code as follows:
<asp: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" >
Database binding to DataList controls </th>
</tr>
<tr>
<TD width= "25%" class= "Tablegrayright" >
Database binding to DataList controls </td>
<TD class= "Tablenoneleft" >
<asp:label id= "Lbltypename" runat= "server" text= ' <%# Eval ("TypeName")%> ' ></asp:Label>
</td><!--Database Binding to DataList controls </tr>
</table>
</ItemTemplate>
</asp:DataList>
Workaround 4:
The text of your control uses <%# Eval ("The It Practitioner's house (www.3ppt.com")%>
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:
Copy Code 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 ();
}