how to set paging in DataList view in Asp.net [Resolved]

Posted by Gow.net under ASP.NET on 2/14/2012 | Points: 10 | Views : 9774 | Status : [Member] | Replies : 4
how to set paging in DataList view in Asp.net any one guide me

gowthaman8870226416


Responses

Posted by: Pradeepkumar417 on: 2/14/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi,

Here i am sending sample code for you. go through attachment.
 Download source file

Thanks & Regards,
Software Engineer,
Pradeep Kumar

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dotnet4ashu on: 2/14/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
<asp:DetailsView ID="dtlv" runat="server" AutoGenerateRows="False"
BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
CellPadding="3" GridLines="Vertical" HorizontalAlign="Center"
AllowPaging="True" onpageindexchanging="dtlv_PageIndexChanging" DefaultMode="ReadOnly" AutoGenerateDeleteButton="False">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right"
VerticalAlign="Middle" />
<Fields>
<asp:BoundField DataField="CategoryId" HeaderText="C Id" />
<asp:BoundField DataField="Product_Name" HeaderText="Product Name" />
<asp:BoundField DataField="Product_price" HeaderText="Price" />
</Fields>
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
<PagerSettings Mode="NumericFirstLast" FirstPageText="<<" LastPageText=">>"
PageButtonCount="1" />

</asp:DetailsView>
At Cs Page
public void bindPaging()
{
SqlDataAdapter da = new SqlDataAdapter("select CategoryId,Product_Name,Product_price from products", con);
DataSet ds = new DataSet();
da.Fill(ds);
dtlv.DataSource = ds;
dtlv.DataBind();
}
protected void dtlv_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
{
dtlv.PageIndex = e.NewPageIndex;
bindPaging();
}

call bindpaging at load..........

I think you can learn it now....

Himanshu Sharma
If you see Dreams then Get Success On Dreams.....

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pradeepkumar417 on: 2/14/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

Go through below link.
http://www.c-sharpcorner.com/uploadfile/rizwan328/datalist-custom-paging-in-Asp-Net-using-C-Sharp/

Thanks & Regards,
Software Engineer,
Pradeep Kumar

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gow.net on: 2/14/2012 [Member] Starter | Points: 25

Up
0
Down
sir i need sample code please sir

gowthaman8870226416

Gow.net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response