TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Qayyum ChauDhary
NA
27
2.5k
How to insert an empty record (row) in asp:Repeater
Jan 8 2020 5:01 AM
How to insert one empty record after every 5 records in the repeater output?
Actually I need to insert one empty record after every 5 records in the repeater output.
For example Repeater original output is following
1.ABC
2.BCD
3.CDE
4.DEF
5.EFG
6.FGH
7.GHI
The desired output will be following
1.ABC
2.BCD
3.CDE
4.DEF
5.EFG
6.FGH
7.GHI
What i have done so far:
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
>
</
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
asp:Repeater
ID
=
"Repeater1"
runat
=
"server"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
'<%#Eval("CustomerName") %>'
>
</
asp:Label
>
<
br
/>
</
ItemTemplate
>
</
asp:Repeater
>
</
div
>
</
form
>
</
body
>
</
html
>
and
public
partial
class
WebForm2 : System.Web.UI.Page
{
SqlConnection con =
new
SqlConnection();
SqlCommand cmd =
new
SqlCommand();
protected
void
Page_Load(
object
sender, EventArgs e)
{
con.ConnectionString =
"Data Source=PC\\SQLEXPRESS;Initial Catalog=AlvisDB;Persist Security Info=True;User ID=sa;Password=pass"
;
con.Open();
cmd.Connection = con;
cmd.CommandText =
"SELECT CustomerName FROM Customers"
;
SqlDataAdapter adp =
new
SqlDataAdapter(cmd);
DataSet ds =
new
DataSet();
adp.Fill(ds);
Repeater1.DataSource = ds;
Repeater1.DataBind();
con.Close();
}
}
Reply
Answers (
2
)
howt to create AjaxFilter for Nopcommerce Product Page ?
PGP text encryption (string encryption code not file)