Click here to Skip to main content
15,891,657 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: In RequireField validator textbox Data is present in the Textbox but its fired Please enter your cardnum1 Pin
User 418025418-Apr-17 4:44
User 418025418-Apr-17 4:44 
QuestionHow to configure sql server profiler to see sql for my session only Pin
Tridip Bhattacharjee12-Apr-17 22:36
professionalTridip Bhattacharjee12-Apr-17 22:36 
AnswerRe: How to configure sql server profiler to see sql for my session only Pin
Richard MacCutchan12-Apr-17 23:48
mveRichard MacCutchan12-Apr-17 23:48 
AnswerRe: How to configure sql server profiler to see sql for my session only Pin
Eddy Vluggen13-Apr-17 0:32
professionalEddy Vluggen13-Apr-17 0:32 
GeneralRe: How to configure sql server profiler to see sql for my session only Pin
Tridip Bhattacharjee13-Apr-17 2:57
professionalTridip Bhattacharjee13-Apr-17 2:57 
QuestionHow SSRS handle large data Pin
Tridip Bhattacharjee12-Apr-17 22:31
professionalTridip Bhattacharjee12-Apr-17 22:31 
QuestionMVC, my views can't see or reference the namespace MvcApplication in Global.asax Pin
jkirkerx12-Apr-17 8:50
professionaljkirkerx12-Apr-17 8:50 
AnswerRe: MVC, my views can't see or reference the namespace MvcApplication in Global.asax Pin
Afzaal Ahmad Zeeshan12-Apr-17 9:17
professionalAfzaal Ahmad Zeeshan12-Apr-17 9:17 
In most cases, I would love to migrate this code to the Controller part, because a View should only be working with a Model, or ViewModel that is gets passed with. This approach is wrong in the first place, the following might be good,
C#
public ActionResult ActionName() {
    // Code.

    ViewBag.websiteName = MvcApplication.GetWebsiteName();
    return View();
}
Then in the View, you can use the helper and write it in the HTML content like,
ASP.NET
<p>The name of the website is @ViewBag.websiteName.</p>
This would help you out in many ways, as you would be migrating the long running tasks — as well as functions, on the controller and the View would only be generating the HTML for those values.

Although, as for your problem, I could try adding,
HTML
@using coastEnvironmental

@{ 
    ViewBag.Title = "My Page";
}

<h4>Content</h4>
<p>Some random stuff</p>
This would work as well, but it is not my recommendation. You should always use the controller for this work, and leave the View to only generate the HTML and not request for anything else — you should also look into the ViewModel or Model-View-ViewModel pattern.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~

GeneralRe: MVC, my views can't see or reference the namespace MvcApplication in Global.asax Pin
jkirkerx12-Apr-17 10:17
professionaljkirkerx12-Apr-17 10:17 
QuestionIs there a control that displays a PDF and submits the pdf back to the server? Pin
Michael Clinton11-Apr-17 9:18
Michael Clinton11-Apr-17 9:18 
AnswerRe: Is there a control that displays a PDF and submits the pdf back to the server? Pin
ChetanAhire17-Apr-17 1:29
ChetanAhire17-Apr-17 1:29 
QuestionWriting multiple records to a binary file, reading the file records so I can add a record and write Pin
jkirkerx10-Apr-17 10:41
professionaljkirkerx10-Apr-17 10:41 
AnswerRe: Writing multiple records to a binary file, reading the file records so I can add a record and write Pin
jkirkerx10-Apr-17 11:38
professionaljkirkerx10-Apr-17 11:38 
QuestionXPagedList, StaticPageList, View, looping items with foreach, loops all the items and not the paginated ones Pin
jkirkerx10-Apr-17 9:17
professionaljkirkerx10-Apr-17 9:17 
AnswerRe: XPagedList, StaticPageList, View, looping items with foreach, loops all the items and not the paginated ones [solved] Pin
jkirkerx10-Apr-17 9:26
professionaljkirkerx10-Apr-17 9:26 
QuestionChange a color of single data labels in graph using crystal reports Pin
Member 1145200410-Apr-17 0:19
Member 1145200410-Apr-17 0:19 
QuestionWebhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 6:39
cotsjdixon31-Mar-17 6:39 
AnswerRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 7:41
mveRichard Deeming31-Mar-17 7:41 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 7:44
cotsjdixon31-Mar-17 7:44 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 7:47
mveRichard Deeming31-Mar-17 7:47 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 7:53
cotsjdixon31-Mar-17 7:53 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 8:26
mveRichard Deeming31-Mar-17 8:26 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 8:29
mveRichard Deeming31-Mar-17 8:29 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
cotsjdixon31-Mar-17 8:44
cotsjdixon31-Mar-17 8:44 
GeneralRe: Webhook receiver from the ground up using ASP.NET? Pin
Richard Deeming31-Mar-17 8:47
mveRichard Deeming31-Mar-17 8:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.