My coding here
index.cshtml
@{
var db = Database.Open("EduCon");
var selectQueryString = "select firstname,lastname,emailaddress from person2";
var data = db.Query(selectQueryString);
var grid1 = new WebGrid(source: data,
defaultSort: "firstname",
rowsPerPage: 5,
sortFieldName:"firstname"
);
CSS
"text/css"> .grid { margin: 4px; border-collapse: collapse; width: 600px; } .head { background-color: #E8E8E8; font-weight: bold; color: #FFF; } .grid th, .grid td { border: 1px solid #C0C0C0; padding: 5px; } .alt { background-color: #E8E8E8; color: #000; } @grid1.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: grid1.Columns(
grid1.Column("firstname", format: @@item.firstname),
grid1.Column("lastname", format: @@item.lastname),
grid1.Column("emailaddress", format: @[email protected] )
)
)

Iftikar HussainRank #423 · 5.9K reputationPosted Jul 18, 2013, 11:09 PM EDT
Are using EntityFramework or LINQ to SQL?
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 18, 2013, 11:32 PM EDT
directly i need to use storedprocedure. from the above example i used directly sql statement like that i need to use stored procedure.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 18, 2013, 11:46 PM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 19, 2013, 12:14 AM EDT
this is my index.cshtml file
Here i used sql query (which i bolded).
Instead of the sql query i need to use my procedurename.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 19, 2013, 12:57 AM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 19, 2013, 2:12 AM EDT
This is my stored procedure output
create,cost,analysis,create,new are assignmentname how do i assign in grid
vidhyaRank #4,868 · 321 reputationPosted Jul 19, 2013, 2:14 AM EDT
If i use this from the above
grid1.Column("marks", format: @@item.marks)
I am getting the error:
'System.Web.Helpers.WebGridRow' does not contain a definition for 'marks'
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 19, 2013, 2:18 AM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 19, 2013, 2:20 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 19, 2013, 3:05 AM EDT
in your cshtml
columns:ViewBag.Columns
Regards,
Iftikar