在html表中启用分页,该表使用yui显示来自sql数据库的数据 [英] Enable Pagination in a html Table which displays data from a sql database using yui

查看:111
本文介绍了在html表中启用分页,该表使用yui显示来自sql数据库的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在yui(雅虎用户界面)的html表中启用分页?该表从sql数据库获取数据.我已在此处附加了用于创建表的c#.net代码.

请尽快回复. :confused :: confused:

How can I enable pagination in a html table in yui(yahoo user interface)? This table takes data from a sql database. I have attached the c#.net code for creating the table here.

Kindly reply asap. :confused::confused:

SqlConnection cnn = new SqlConnection("Server=.;Initial Catalog = AdventureWorksDW;Integrated Security =True");
string qry = "SELECT top 100 [fldname1],[fldname2],[fldname3],[fldname4],[fldname5],[fldname6] FROM [Customer]";
SqlCommand cmd = new SqlCommand(qry, cnn);
cmd.Connection.Open();
SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
string strTable = "<table class=''datatable''>";
strTable += "<thead>";
strTable += "<tr><th id=''customerkey''>CustomerKey</th><th ><a href=''javascript:display(this,\"firstname\")''>FirstName</a></th><th id=''lastname''>Lastname</th><th  id=''BirthDate''>DOB</th><th id=''MaritalStatus''>Marital Status</th><th id=''EmailAddress''>Email</th></tr>";
strTable += "</thead>";
strTable += "<tbody>";
while (myReader.Read())
{
  strTable += "<tr><td>" + myReader[0].ToString() + "</td><td>" + myReader[1].ToString() + "</td><td>" + myReader[2].ToString() + "</td><td>" + myReader[3].ToString() + "</td><td>" + myReader[4].ToString() + "</td><td>" + myReader[5].ToString() + "</td></tr>";
}
myReader.Close();
strTable += "</tbody></table>";
Response.Write(strTable);

推荐答案

使用gridview并将use pagination值设置为true吗?

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.allowpaging.aspx [
Use a gridview and set the use pagination value to true?

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.allowpaging.aspx[^]


感谢您的回复...我希望它可以使用YAHOO用户界面进行工作和javascript.实际上我只需要使用html表,而不能使用gridview或listview.

问候,
Manu. :) :-D

:thumbsup:
thanks for the reply...i gt it to work using YAHOO USER INTERFACE and javascript.Actually i had to use just the html table and not the gridview or the listview.

Regards,
Manu. :) :-D

:thumbsup:


这篇关于在html表中启用分页,该表使用yui显示来自sql数据库的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆