Hi sir how to create paging inside the div.. actually I am fetching the data from database (sql server) with the help of stored procedure and the add to the placeholder control in asp.net. I want to display only 5 links at a time and then user click on next number it will display another five link..i want to create like this only so please suggest sir how is it possible in asp.net
--------------------------------------------------------------------stored procedure-------------------------------------------------------------------------------------
ALTER PROCEDURE [dbo].[sp_allnames]
(
@article_Category varchar(1)
)
AS
BEGIN
create table #tmp
(
id int identity(1,1),
Main_article varchar(100),
sub_article varchar(500),
brief_Article varchar(max),
filter varchar(100),
article_list_cnt int,
a_tag varchar(500)
)
create table #tmp_brief
(
Main_article varchar(100),
sub_article varchar(500),
brief_Article varchar(max),
id int
)
insert into #tmp_brief
select hl.lookup_description,category,brief_article,artical_id from hpp2_articles ha
join HPP2_Content_Master hcm on ha.Content_Id = hcm.Content_Id
join HPP_Lookup hl on ha.page_name = hl.lookup_value and hl.lookup_code ='P_HPP_ArtclSubCategory'
where ArticalCategory ='P' and ha.active_flag ='Y'
--group by hl.lookup_description,category
order by hl.lookup_description
insert into #tmp
(Main_article,sub_article,article_list_cnt)
select 'All Categories','',0 --union all
--select 'default','',0
insert into #tmp
(Main_article,sub_article)
select distinct hl.lookup_description,category from hpp2_articles ha
join HPP2_Content_Master hcm on ha.Content_Id = hcm.Content_Id
join HPP_Lookup hl on ha.page_name = hl.lookup_value and hl.lookup_code ='P_HPP_ArtclSubCategory'
where ArticalCategory = @article_Category and ha.active_flag ='Y'
--group by hl.lookup_description,category
order by hl.lookup_description
--update #tmp
--set brief_Article = '<strong>'+sub_article+'</strong><ul class="diet-content-ul" >'
--select * from #tmp_brief
declare @Main_article varchar(100), @sub_article varchar(500),@brief_Article varchar(max),@article_id int
DECLARE Article_Cursor CURSOR FOR
SELECT Main_article,sub_Article FROM #tmp
/*SELECT main_Article,sub_Article,brief_Article,id
FROM #tmp_brief
*/
OPEN Article_Cursor
FETCH NEXT FROM Article_Cursor into @Main_article,@sub_article--,@brief_Article,@article_id
WHILE @@FETCH_STATUS = 0
BEGIN
set @brief_Article = null
--select @Main_article,@sub_article,@brief_Article,@article_id
select @brief_Article = isnull(@brief_Article,'') + '<li><a class="iframe" href="Articles.aspx?id='+convert(varchar,id)+'" target="_blank">'+brief_Article+'</a></il>'
from #tmp_brief where main_Article = @Main_article and sub_article = @sub_article
if(ISNULL(@brief_Article,'') <> '')
Begin
--'<div class="diet-col-content" style="padding-top: 0px;"><img src="../images/HPP2/newsfeed/Diet_Articles.jpg" class="diet-plan-thumb" alt="" /></div>'
update #tmp
set brief_Article = '<strong>'+sub_article+'</strong>'+
case when ltrim(rtrim(sub_article))='Diet' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'11"><img src="../images/HPP2/newsfeed/Diet_Articles.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='Fitness' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/Fitness_Articles.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='Lifestyle' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/Lifestyle_Articles.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='Antenatal Tests ' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/Antenatal Tests_Articles.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='Birth and Beyond' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/Birth and Beyond_articles.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='First Trimester' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/1stTrimister_Article.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='Labor and Delivery' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/labor and Delivery_Articles.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='Medical Review' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/Medical Review_Articles.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='Pre-conception' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/2ndTrimister.jpg" class="diet-plan-thumb" alt="" /></div>'
when ltrim(rtrim(sub_article))='Third Trimester' then '<div class="diet-col-content" style="padding-top: 0px;" id="'+ ltrim(rtrim(sub_article)) +'"><img src="../images/HPP2/newsfeed/3rdTrimister.jpg" class="diet-plan-thumb" alt="" /></div>'
end
+'<ul class="diet-content-ul" id="'+ ltrim(rtrim(sub_article)) +'10">'+@brief_Article+'</ul>'
where Main_article = @Main_article and sub_article = @sub_article
/*ISNULL(#tmp.brief_Article,'') + ' ' +ha.brief_article
from #tmp_brief tb
inner join hpp2_articles ha on ha.category = tb.sub_article and ha.artical_id = tb.id
join HPP2_Content_Master hcm on ha.Content_Id = hcm.Content_Id
join HPP_Lookup hl on ha.page_name = hl.lookup_value and hl.lookup_code ='P_HPP_ArtclSubCategory'
--join #tmp_brief tb on tb.Main_article = #tmp.Main_article and tb.sub_article = #tmp.sub_article
where ha.category = #tmp.Main_article
and hl.lookup_description = #tmp.sub_article
and tb.Main_article = @Main_article
and tb.sub_article = @sub_article
and tb.id = @article_id*/
--and hcm.ArticalCategory = @article_Category
End
FETCH NEXT FROM Article_Cursor into @Main_article,@sub_article--,@brief_Article,@article_id
END
CLOSE Article_Cursor;
DEALLOCATE Article_Cursor;
--declare @list_data varchar(max)
--select @list_data = @list_data + '<strong>'+sub_article+'</strong><ul class="diet-content-ul" ><li><a class="iframe2" target="_blank" href="ExerciseDescription.aspx?id='+1+'" style="text-decoration: none; font-size: 12px; font-family: Arial, Helvetica, sans-serif">'+brief_Article+'</a></li>' from #tmp
update #tmp
set filter = '.'+Main_article where Main_article <> 'All Categories'
update #tmp
set filter = '*'
where Main_article = 'All Categories'
--update #tmp
--set filter = 'default'
--where Main_article = 'default'
update #tmp
set a_tag = '<a href="#" data-filter="*">'+LTRIM(RTRIM(Main_article))+'</a>'
where Main_article = 'All Categories'
update #tmp
set a_tag = '<a href="#" data-filter=".'+LTRIM(RTRIM(REPLACE(Main_article,' ','')))+'">'+LTRIM(RTRIM(Main_article))+'</a>'
where Main_article <> 'All Categories'
select distinct Main_article,filter,a_tag from #tmp
select LTRIM(RTRIM(Replace(Main_article,' ',''))) 'Main_article','isotope-item article_panel ' + LTRIM(RTRIM(REPLACE(REPLACE(filter,' ',''),'.',''))) 'filter',sub_article,
brief_Article
from #tmp
select * from #tmp
END
------------------------------------------------------------------end of procedure---------------------------------------
public void BindAllArticles()
{
DataSet dsDiv = new DataSet();
dsDiv = bl.GetMainArticleList("P");
for (int i = 0; i < dsDiv.Tables[1].Rows.Count; i++)
{
string a = dsDiv.Tables[1].Rows[i]["Main_article"].ToString();
if (dsDiv.Tables[1].Rows[i]["Main_article"].ToString() != "AllCategories")
{
HtmlGenericControl myDiv = new HtmlGenericControl("div");
myDiv.ID = dsDiv.Tables[1].Rows[i]["Main_article"].ToString() + i.ToString();
HtmlGenericControl myul = new HtmlGenericControl("ul");
HtmlGenericControl myli = new HtmlGenericControl("li");
myul.Style.Add("width", "100%");
myli.Style.Add("width", "100%");
myli.Style.Add("list-style-type", "none");
//myli.Style.Add("white-space", "nowrap");
myul.Attributes.Add("class", "diet-col");
myul.Controls.Add(myli);
HtmlGenericControl li_div = new HtmlGenericControl("div");
li_div.Attributes.Add("class", "diet-col-content");
li_div.InnerHtml = dsDiv.Tables[1].Rows[i]["brief_Article"].ToString();
myli.Controls.Add(li_div);
myDiv.Attributes.Add("class", dsDiv.Tables[1].Rows[i]["filter"].ToString());
//myDiv.Style.Add("display", "inline");
//myDiv.InnerHtml = "Inside DIV Inside DIV";//dsDiv.Tables[1].Rows[i]["sub_article"].ToString();
//myDiv.Controls.Add(img);
myDiv.Controls.Add(myul);
plh1.Controls.Add(myDiv);
}
}
------------------
how is it possible sir me suggest me ..