Create page at run time with Dynamic controls.
Hi All,
How we generate page at run time (I mean the user create page run time) and also Drag and Drop the Controls or how we will provide a option for Drag and Drop the Controls on that page. and after this process user will save the form. Then after another User will use this page for fill the information send back to the owner of the form.
Using Asp.net.
Can you help me ?
Purushottam RathorePosted Dec 31, 2009, 1:03 AM
Write the following code to create page on run time...
ViewState["FilePath"].ToString().ToLower() == "default")
FileStream outputfile = null;
string sFolder = "";
sFolder = "../UploadFile/" + ViewState["UserID"].ToString();
if (!object.Equals(ViewState["FilePath"], null))
{
outputfile = new FileStream(MapPath("../UploadFile/" + ViewState["UserID"].ToString() + "/" + ViewState["FilePath"].ToString() + ".aspx"), FileMode.Create, FileAccess.Write);
}
else
{
if (!Directory.Exists(MapPath(sFolder)))
Directory.CreateDirectory(MapPath(sFolder));
filePath = sFolder + "/" + "/Default";
outputfile = new FileStream(MapPath(filePath + ".aspx"), FileMode.Create, FileAccess.ReadWrite);
}
using (StreamWriter streamWriter = new StreamWriter(outputfile))
{
string sArticle = "";
SetDesignValue(out sArticle);//Create this function for design content by yourself as you recuired.
streamWriter.WriteLine(sArticle);
streamWriter.Flush();
streamWriter.Close();
outputfile.Close();
}