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
NAGARAJU TAMADA
NA
205
285.7k
How to creating Paging in asp.net mvc3 project?
Oct 8 2013 6:46 AM
Hi all
Iam working with Asp.net mvc3 Project.Here in my list view I want to creating paging
I tired alot i didn't get any solution please provide solution
my model class is
SelectSiteModel.cs
public class SelectSiteModel
{
//[Required]
//public string SiteID { get; set; }
[Required]
public string SiteName { get; set; }
[Required]
public string SiteAddress { get; set; }
[Required]
public string WorkOrderNo { get; set; }
public DataSet GetAllSiteDetails()
{
SqlConnection cn = new SqlConnection(@"Data Source=USHODAYA-PC1;Initial Catalog=VendorManagement;Integrated Security=True");
SqlCommand cmd = new SqlCommand("Select * From Site", cn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
return ds;
}
}
and my
Cotroller
code is
public ActionResult Index(SelectSiteModel selectSiteModel)
{
DataSet ds = selectSiteModel.GetAllSiteDetails();
ViewBag.SiteList = ds.Tables[0];
return View();
}
Index.cshtml
is
<table>
<tr>
</tr>
<tr> <td></td>
<td style="background-color: #800080; color: #FFFFFF; font-family: 'Times New Roman', Times, serif;
font-size: large; border-style: inset; border-width: thin">
SiteID
</td>
<td style="background-color: #800080; color: #FFFFFF; font-family: 'Times New Roman', Times, serif;
font-size: large; border-style: inset; border-width: thin">
SiteName
</td>
<td style="background-color: #800080; color: #FFFFFF; font-family: 'Times New Roman', Times, serif;
font-size: large; border-style: inset; border-width: thin">
Site Address
</td>
<td style="background-color: #800080; color: #FFFFFF; font-family: 'Times New Roman', Times, serif;
font-size: large; border-style: inset; border-width: thin">
Site WOrkOrderNo
</td>
</tr>
@foreach (System.Data.DataRow dr in ViewBag.SiteList.Rows) {
<tr>
<td>
@Html.ActionLink("Edit", "UpdateSite", new { id = dr["SiteId"].ToString() })
@* @Html.ActionLink("Delete", "Delete", new { id = dr["SiteId"].ToString()})*@
</td>
<td>
@dr["SiteId"].ToString()
</td>
<td>
@dr["SiteName"].ToString()
</td>
<td>
@dr["SiteAddress"].ToString()
</td>
<td>
@dr["WorkOrderNo"].ToString()
</td>
</tr>
}
</table>
Please give solution for this
Regards
NagaRaju
Reply
Answers (
1
)
change the dropdown value according to textbox value.
how to get gridview cell value to label?