Can I design a webPAGE with asp.net? - c#

I work with c# for a while now for programming.And I know this may be a stupid question,but is it possible to design a webpage(not a web app)using c# in asp?and if yes,where can I begin from?

Yes
a basic HTML page with .aspx extension is also runnable with IIS
You might also want to look into razor and developing a front end with it.
See webmatrix from Microsoft and don't forget to look into https://developer.mozilla.org/en-US/

Related

How Can I use HTML Helper in asp.net? [duplicate]

I'm liking the Razor syntax that Microsoft has developed for inline coding in their WebMatrix product (http://en.wikipedia.org/wiki/Microsoft_WebMatrix).
Now that Visual Studio SP1 has RTM'd, is it possible (and/or planned) to enable the use of Razor syntax in ASP.NET Webforms?
We (the ASP.NET team) currently have no plans to support the WebForms page model using Razor syntax. Furthermore it is unlikely that we would ever seriously consider this as the models are too different to make the two work together.
You can use Razor pages without MVC; this is called ASP.Net WebPages.
Just add .CSHTML files to a normal ASP.Net 4.0 project.
I explained how this works in my blog.
You could possibly integrate it using the RazorEngine available from Codeplex. It allows you to process razor outside of MVC. Though you don't get all the features you get from the MVC version of Razor, such as #Html and #Url and others.
I dare say that Microsoft have considered it, but there is no official word on the subject. Since you are not supposed to have C# or VB code in the ASPX file, you have to wonder about the point of adding Razor support to Web Forms. The code behind would still be a (partial) class file. You wouldn't put Razor there any more than you would put it in a class file in Web Pages or MVC. And swapping Server Controls and all that good declarative stuff for Html Helpers removes one of the key reasons for going the Web Forms route, IMO.
This really isn't that difficult to do. Working on it right now. Grab RazorEngine from CodePlex. It lets you compile Razor cshtml/vbhtml files into a class at runtime.
You can then take that class, and use it from a ASP.Net server control, inside its Render method. This is a great way to get HTML out of the body of a server control. Much, much cleaner.
Now, you can also add some methods that you can invoke from Razor. For instance, add something like RenderChild. Additionally, you could set the Server Control itself as the Model available to Razor. You could then invoke into the server control. Including doing something like grabbing one of it's child controls and invoking Render.

There is no Default.aspx.cs file into my webapplications project

Before telling you anything i'd like to clear, I'm a completely beginner in ASP.NET. In fact, I started learning today ASP.NET.
So, I'm making an event that would bind my code with C# files. Well I'm good in C#.
But the problem is as I find into projects, there is no Default or any aspx.cs files here. Can you please help? Where can I find it?
This tutorial says that to bind events, you need to write code in .cs files.
Here is my how my project is setup:
I think you have choosen a wrong project type while creating your project.For your purpose you need to do following
File>New>Project
On the left panel Go Visual C# > Web
Select ASP.NET Web Forms Application
Looking at your screenshot it seems you selected "ASP.NET Empty Web Application".You can add files to this as well but since you are a beginner its better to follow above steps.

DISQUS comments in asp.net webforms

Hi i want to use DISQUS comments system. But i couldnt find any resource for C# asp.net webforms, examples , source code or implement. I have found a project in codeplex and CodeProject
but it seems that the code is in MVC i haven't used MVC . Where can i find DISQUS implementation code in Asp.net C# webforms? not MVC.
In most cases implementing Disqus into a website is really easy, since you're not actually building all the markup. At the minimum, you just need to add the Universal Code on the proper page templates, which links to the embed javascript file and the "disqus_thread" DIV.
At that point to make a "complete" integration, you just need to output some javascript configuration variables (using a unique identifier, URL, and title for each thread) and maybe the comment counting script and that should be it.
The only webforms-specific examples you might possibly need are how to output the article's unique ID, title and URL variables onto the page. So if you have a good idea of how to do that, you shouldn't need an existing integration.

ASP.NET C# Properly Generating HTML for Page

I realize this is probably a fundamental thing I should know but I am self-teaching myself C# and asp.net so I am a little lost at this point.
I right now have 2 pages. One is an .aspx (with aspx.cs file included) that is blank and html is generated for it from a Page_Load function in the cs file. The HTML is very simple and it is just an image and some text.
The second file is a shtml file which has lots of things, serverside includes, editable and noneditable areas. I want to put my webapp into this file. My asp.net app uses Response.Write to just write out the html. This does not flow well with this page as all that does is write it at the top of the page which is because it is ran first and generates it at the top.
How can I make it to where I can generate HTML code inside the page, like within a specific DIV so it does not mess up the page. Where would a starting point be in learning how to do that.
I should note that I do not need any interaction from the user. All of this should generate right away.
I think you need to read up on some basic ASP.Net documentation and tutorials. Response.Write is not the correct approach - you need to understand how the ASP.Net page lifecycle works and how WebControls are used to render the html.
ASP.Net tries to abstract away having to create your html manually for the most part.
So if i have understood the questions correctly.
You already have an existing page/application (the shtml file) that you want to extend with some new ASP.NET components by including output from the ASP.NET page in the existing page?
This is as not something that is out of the box "supported" by ASP.NET and you "won't" be able to execute the aspx page using SSI. But you can do the opposite, an ASP.NET page does support SSI. So if you are not using any other scripts in the shtml file this might be a solution.
Otherwise the only common solutions would be either to use an AJAX framework and let it call the ASP.NET from within the existing pages or to use an iframe solution. In both cases the client will be resposible for making the calls to the ASP.NET pages and merging the results.
And then you have a issue with controlling the output from the ASP.NET page?
The Polymorphic Podcast has a good article on Controlling HTML in ASP.NET WebForms .
You can add a Literal control to the page inside the div:
<div>
<asp:Literal ID="litMarkup" runat=server />
</div>
then in your code-behind:
litMarkup.Text = "<strong>Your markup</strong>";
I don't know how well this would work for you, but could you try using an iframe to house the ASP.NET page? This should keep it in the specified region and not overwriting your shtml file. It may be something to think about.
If it is necessary that you generate your HTML output from C# code, and you would use this in more than one place, I think you may be thinking of something like what are called ASP.NET Custom Controls (not to be confused with "User Controls"-- though you probably could put together a solution with those as well, using a Literal control as another person suggested). The MSDN documentation would be a good starting point. In general, though, the writing-out-HTML-yourself-from-code model (like you would with, say, CGI applications), is not the usual ASP.NET model of development, as it largely defeats the point of using ASP.NET at all. You'd mostly want to do this sort of thing if you are writing your own web control, though this might be exactly what you are doing (hard to tell from the description).

Working with Dreamweaver and ASP.NET - is this recommended?

I am a ASP.NET 3.5 web developer using VS 2008. I just started at a new company and there are alot of Web Designers here (never worked with Web Designers before). They all use Dreamweaver CS3 and PhotoShop (something i know nothing about).
What I would like to know is the following:
Would they have problems opening my ASP.NET pages in Dreamweaver? ( I heard they might not be able to ).
What about when i use MasterPages? Will they be able to open my pages when i use MasterPages, or must i stay away from MasterPages?
Thanks in advance!
They will be able to work with the markup in your aspx pages, as long as you aern't using complex server controls. Keep the markup fairly simple and you'll be OK. With master pages, they should be able to handle the layout stuff they need, and leave you to worry about the content areas. If you have the opportunity, try to go down a MVC route, this way you are encouraged to keep the code and the markup separate, and the designers will have an easy time seeing your aspx and ascx markup. Designers aren't evil, just different :)

Categories

Resources