.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

create a form to create an ascx page and code behind for it

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
Is is possible to build a form, accept parameters and from THAT construct a new .ascx page AND the code behind for that page? What I'm proposing is having some code snippets that just need parameters added and can then be used to create a web user control that can be added to existing pages. This .ascx file would be a real file after creation, not dynamic every time.I don't know if I'm describing it very well, maybe someone could point me in the right direction.

View Complete Post

More Related Resource Links

how do I create/show modal form using the following code?

The text contained in a .txt file loaded with the following code doesn't show up in the RichTextBox control on a separate form which has been instantiated and launches sucessfully.  Why don't the contents of the .txt file show up in the RichTextBoxControl on the instantiated form?  Thank you for ideas! private void ToolStripMenuItemOpenAlarmHistory_Click(object sender, EventArgs e) { OpenFileDialog openFile1 = new OpenFileDialog(); FormAlarmHistory_Loaded_Into_RichTextBox formAlarmHistory; openFile1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; if(openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK && openFile1.FileName.Length > 0) { using (formAlarmHistory = new FormAlarmHistoryLoadedIntoRichtTextBox()) { dialogResult = formAlarmHistory.ShowDialog(); if (dialogResult == DialogResult.OK) { formAlarmHistory.richTextBoxPrintCtrlForLoadedAlarmHistory.LoadFile(openFile1.FileName); } } } }

Does anyone know how to create a page that has Code behind in Sharepoint.

I am creating a page that will need some controls for dropdowns and radio buttons etc and I need to know if and how to setup and create a page in Sharepoint that has the code behind to handle click events, onselectedchange like .NET does.

Create new aspx-page from code


Hello everyone.

I'm am looking for a general idea about the following:


My customer is looking for an application - a sort of webshop-like thingie, where each product has its own infopage with a unique URL.

He does NOT want an actual CMS.

I could - and probably will - use querystrings, like http://www.example.com/products.aspx?pID=21, and then get the content from the database, but is it possible - or rather possible without too much bother - to let the administrator input text via a webform, and then form code create a contentpage like http://www.example.com/product21.aspx

Have a nice weekend



How to create a code behind page when page was created in expressions web


 When an ASPX page is created and designed in Expressions Web (which has no code behind page check box), how do I add a code behind file in VWD2008? 

The help says the following:

Adding code-behind files in ASPX or ASCX files within a traditional ASP.NET 2.0 environment is very easy thanks to Microsoft Visual Studio. All you have to do is right-click the file in Visual Studio, either in Solution Explorer or in the designer, and select View Code. Visual Studio then creates a new code behind file (if one did not already exist)

but doing the above simply displays the ASPX page. 

I follow creating a code behind page when creating a new ASPX page in VWD2008 (although I have not done it) by simply checking the box.

Any ideas?



Create single custom login page for Windows Authentication and Form Based Authentication.


I want to create a custom login page for both Windows Authentication and Form Based Authentication.

I mean to I have to create only single login page for both authentication.

How can I create this kind of page?

G. Goyal

Create a Wiki page from a template or form


after searching around all day for an appropriate answer I have come up with zilch

I have read alot of similar posts buth nothing seems to match my needs. Sorry if I'm just looking in the wrong place.
just found the following, exactly what I want too

What I am trying to do is create a template or form so users can click a link to create a new page from that template or form. what should i use and how should i do it? do i make a form? do i make a page layout??

a wiki page for each server that shows details about what services it runs and what network its on ect. ect.


hope this is clear as to what im talking about, just dont have the time at the moment to re think what im writing.
thanks in advance

form feild hints are not displaying for textboxses inside create user wizard?



I'm using following JS code to display input hint box besides the textbox whenever that asp.net textbox receives focus. 

I'm doing this for a registration form and all of the textboxes are inside the asp.net create user wizard control.

<script type="text/javascript">
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {

function prepareInputsForHints() {
	var inputs = document.getElementsByTagName("TextBox");
	for (var i=0; i<inputs.length; i++){
		// test to see if the hint span exists first
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
			// the span exists!  on focus, show the hint
			inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			// when the cursor moves away from the field, hide the hint
			inputs[i].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";

Create/add table from code to database



I create table:

                  DataSet data=new DataSet();

                  DataTable myTable = new DataTable("NewTable");

                   DataColumn[] keys = new DataColumn[1];

                   // create column
                   keys[0] = new DataColumn();
                   keys[0].DataType = System.Type.GetType("System.String");
                   keys[0].ColumnName = "PointID";
                   myTable.Columns.Add(keys[0]);    &nb

Form Filler: Build Workflows to Capture Data and Create Documents


Learn how to create a workflow that uses InfoPath forms and other office documents for passing data to targeted activities and for use in Office documents.

Rick Spiewak

MSDN Magazine June 2008

C#: Create Elegant Code With Anonymous Methods, Iterators, And Partial Classes


In this article Juval Lowy describes how exciting new features in Visual Studio 2005, that will improve your overall productivity compared to the first version of C#, so you can write cleaner code faster.

Juval Lowy

MSDN Magazine Visual Studio 2005 Guided Tour 2006

C# 2.0: Create Elegant Code with Anonymous Methods, Iterators, and Partial Classes


C# 2.0 introduces a wealth of exiting new features, such as generics, iterators, partial classes and anonymous methods. While generics are the most talked-about feature especially for former classic C++ developers, the rest of the new features are important additions to your .NET development arsenal, enhancing power and improving overall productivity. This article is dedicated to all the new C# 2.0 capabilities besides generics to give you a good overall picture of the upcoming features.

Juval Lowy

MSDN Magazine May 2004

Code Name Avalon: Create Real Apps Using New Code and Markup Model


The presentation subsystem in the next version of Windows, code-named "Longhorn," offers powerful new capabilities to developers. This subsystem, code-named "Avalon," allows developers to take advantage of its capabilities through a new markup language code-named "XAML." In addition, modern object-oriented programming languages such as C# and Visual Basic .NET can be used to tie everything together. Because most applications written to Avalon will probably be a mix of XAML and programming code, this article discusses XAML tags used to control page layout along with the procedural code written to respond to events.

Charles Petzold

MSDN Magazine January 2004

Want to create Page URL rewrite based on Users GUID and Display name?



I am using the asp.net membership. 

On my site I have a Profile.aspx page.

In the code behind of this page,  i get the logged in UserId (Guid) and pass

this to a method in my DAL. GetUserByUserId()


In my database I have a Table called Member which the method gets the data from

and displays details on the page about  the user.


What I want to happen is when they have logged in and are diverted to Profile.aspx,

the page URL shows www.MyWebSite/Profile/UsersName 

for example



is this possible. In my Member table I have FirstName and LastName columns or do I get the

name from the membership table.


even better would be they go straight to www.MyWebsite/JohnSmith.aspx


thank you for any help






I want to create registration page and login page


I have design form layouts for signup and login pages 

Please provide me the step by step code for sign up and login pages using c# with validation.

waiting for urgent reply

Create databound nested ajax toolkit accordion programatically(In code Behind)


Can anyone guide me in the right direction or give an example of How I would accomplish this?


I have  this so far but kind of stuck on how to do it programtically if I'm using header and content templates 

I have a xmldatasource.. In a nutshell at what point in my code do I need to create a new accordion? does it need to be

in the item_databound handler?


Imports Microsoft.VisualBasic

Public Class AccordionTemplate
    Implements System.Web.UI.ITemplate

    Dim templateType As String

    Sub New(ByVal type As String)
        templateType = type
    End Sub

    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) _
          Implements System.Web.UI.ITemplate.InstantiateIn

        Dim ph As New PlaceHolder()

        Select Case (templateType)
            Case "Header"
                Dim myLabel As Label = New Label()
                myLabel.Text = "Test"
            Case "Content"
                ph.Controls.Add(New LiteralControl("<p>hello</p>"))
        End Select
    End Sub

End Class



Partial Class Accordion
    Inherits System.Web.UI.Page


InfoPath form checked out so 'on create' workflow not being started


Hi all,


I have found a couple of threads asking for advice on how to check in an InfoPath form when it’s saved or submitted to a forms library. The reason for doing this is so a workflow can start based on a new item being created in that library, and so it doesn’t just sit there with a “Starting” status.


The answers I have found contradict each other:

·         You have to do it with a workflow.  This can be done easily with SharePoint Designer if that's an option for you. Source:

Programmatically create an InfoPath form


I'm programmatically creating an InfoPath form using this article: http://www.bizsupportonline.net/infopath2007/programmatically-create-infopath-form-console-app.htm.


Everything works well up to 29 fields (my:field1 ... my:field29). After that it runs without an error and posts a form to the library however the icon does not switch to an infopath icon and the filename stays blanks. I don't believe this field specific, it seems to be happening when I use any 29 to 30 fields so I'm thinking its a memory issue with the stream reader.

Has anybody every had this issue before, is there a way to fix this?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend