CookieName.Path = "/Articles/";
CookieName.Domain = "www.dotnetfunda.com";
CookieName.Domain = "www.dotnetfunda.com";
DropDownList code <asp:DropDownList ID="dropDown1" runat="server"></asp:DropDownList> Namespace to use using System.Globalization; Code behind DateTimeFormatInfo info = DateTimeFormatInfo.GetInstance(null); for (int i = 1; i < 13; i++) { //Response.Write(info.GetAbbreviatedMonthName(i) + "<br />"); dropDown1.Items.Add(new ListItem(info.GetMonthName(i), i.ToString())); }
<authentication mode = " [Windows/Forms/Passport/None] "> <forms name = " [name] " loginUrl = " [url] " > <credentials passwordFormat = " [Clear, SHA1, MD5] "> <user name = " [username] " password = " [password] " /> </ credentials> </forms> <passport redirectUrl = "internal" /> </ authentication> <authorization> <allow users = " [mention list of users separated by comma] " roles = " [mention list of roles separated by comma] " /> <deny users = " [mention list of users separated by comma] " roles = " [mention list of roles separated by comma] " /> </ authorization> <identity impersonate = " [true/false] " />
void Application_BeginRequest(object sender, EventArgs e) { Context.Items.Add("startime", DateTime.Now); } void Application_EndRequest(object sender, EventArgs e) { //Get the start time DateTime dt=(DateTime)Context.Items["startime"]; //calculate the time difference between start and end of request TimeSpan ts = DateTime.Now-dt; Response.Write("number of milleseconds for execution"+"--"+ts.TotalMilliseconds); }
step1: connect with the database. using System.Data.Sqlclient; sqlconnection conn=new sqlconnection("server=....;user id=...;password=...."); step2: Enter the table name in a textbox,and displaying the table information protected void TextBox1_TextChanged(object sender, EventArgs e) { try { string s1 = TextBox1.Text; //passing a query to fetch the table from database,which is entered in textbox string s2 = "select * from " + s1; SqlDataAdapter da = new SqlDataAdapter(s2, conn); da.Fill(ds); DataTable dt = new DataTable(); dt = ds.Tables[0]; //creating a table dynamically HtmlTable table = new HtmlTable(); HtmlTableRow tr = null; HtmlTableCell tc = null; //displaying labels for displaying coloumn names in the table if (dt.Columns.Count - 1 > 0) { tr = new HtmlTableRow(); for (int i = 0; i < dt.Columns.Count; i++) { tc = new HtmlTableCell(); Label lbl = new Label(); lbl.Text = dt.Columns[i].ColumnName; lbl.ID = "lbl" + dt.Columns[i].ColumnName; tc.Height = "50px"; tc.Width = "150px"; tc.Controls.Add(lbl); tr.Controls.Add(tc); } table.Controls.Add(tr); //creating textboxes for displaying records information for (int j = 0; j < dt.Rows.Count; j++) { tr = new HtmlTableRow(); for (int k = 0; k < dt.Columns.Count; k++) { tc = new HtmlTableCell(); TextBox txt = new TextBox(); txt.ID = "txt" + j + k; txt.Text = dt.Rows[j][dt.Columns[k].ToString()].ToString(); tc.Controls.Add(txt); tr.Controls.Add(tc); } table.Controls.Add(tr); } form1.Controls.Add(table); } } catch (Exception ex) { Response.Write("Please enter a valid table"); } }