16,019,199 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Ruter11 (Top 10 by date)
Ruter11
3-Mar-19 21:10pm
View
I need something like this:
{"Container":[
{"ContainerId":"1","ContainerName":"Container1"},
{"ContainerId":"2","ContainerName":"Container2"},
{"ContainerId":"3","ContainerName":"Container3"},
{"ContainerId":"4","ContainerName":"Container4"}
]
}
Ruter11
22-Oct-13 4:21am
View
yes i am not loading model on page load please let me know how to do that
Ruter11
7-Sep-13 0:51am
View
I will try this one but I want the e.g. in which values are comming from SQL database using Entity Framework
Ruter11
6-Sep-13 5:28am
View
It is ASP .Net MVC Razor and Jquery to create MultiSelected Drop Down List...I changed the question little bit please see again
Ruter11
4-Sep-13 1:09am
View
Thanks for reply. I will try this and then let you know :)
Ruter11
31-Aug-13 7:14am
View
I want MultiSelect DropDown List for MVC ...... This for ASP .Net without MVC
Ruter11
30-Aug-13 0:29am
View
Thanks for reply I will try this
Ruter11
29-Aug-13 12:21pm
View
Thanks for reply but I want dynamic column as column are generating according to parameter passed that means no. of col and name of column .......... that's why I took List<<dynamic>>......... if you have any other solution to create auto generated columns in MVC please let me know
Ruter11
29-Aug-13 8:49am
View
My scenario is something like this that my stored procedure is returning differ column(like name og column and no of column) while I am passing parameter through drop down list ,do you have any solution how can I achieve this
Ruter11
29-Aug-13 5:50am
View
Deleted
Hi thanks for the reply I changed the return type now I am getting new error , my stored procedure is changing the no. of columns(fields) dynamically according to the parameter passed to it through dropdownlist.... As I am new in MVC Please help in same... This error is coming after retuning the result from GetList(String MatchTypeName)..... Error: The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[System.Object]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[LearningMVC.Controllers.MyController]'.
public ActionResult Index(string MatchTypeName)
{
foreach (MatchTypeMaster MatchType in db.MatchTypeMasters)
{
SelectListItem selectMatchTypes = new SelectListItem
{
Text = MatchType.MatchTypeName,
Value = MatchType.MatchTypeID,
};
selectMatchTypeList.Add(selectMatchTypes);
ViewBag.MatchTypeName = selectMatchTypeList;
}
if (string.IsNullOrEmpty(MatchTypeName))
{
MatchTypeName = "XYZ";
var bugedlist = GetList(MatchTypeName);
return View(bugedlist);
}
else
{
var GridFill = GetList(MatchTypeName);
return View(GridFill);
}
return View();
}
public List GetList(String MatchTypeName)
{
//var modelList = new List();
var result = new List();
using (SqlConnection conn = new SqlConnection(@"Server= server_name; Uid=xyz;pwd=pass; database=db_name"))
{
try
{
conn.Open();
SqlCommand dCmd = new SqlCommand("SP_WEBBASEDREPorTS", conn);
dCmd.CommandType = CommandType.StoredProcedure;
dCmd.Parameters.Add(new SqlParameter("@MatchType", MatchTypeName));
dCmd.Parameters.Add(new SqlParameter("@ModeFlag", "Batting Industry Average"));
SqlDataAdapter da = new SqlDataAdapter(dCmd);
DataSet ds = new DataSet();
DataTable table = new DataTable();
ds.Clear();
da.Fill(table);
conn.Close();
foreach (DataRow row in table.Rows)
{
var obj = (IDictionary<string,>)new ExpandoObject();
foreach (DataColumn col in table.Columns)
{
obj.Add(col.ColumnName, row[col.ColumnName]);
}
result.Add(obj);
}
}
catch
{
}
}
return result;
-----------------------------------------------------------------------
CSHTML Code is:
@using GridMvc.Html;
@model IEnumerable
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@*
@Html.ActionLink("Create New", "Create")
*@
@using (@Html.BeginForm("Index", "My", FormMethod.Get))
{
@Html.DropDownList("MatchTypeName", "Select All");
<input type="submit" value="Filter" />
}
@Html.Grid(Model).AutoGenerateColumns().Sortable(true)
Show More