Empowering The World Through Technology

Add webpage in a website using C#, asp.net in visual studio.

0 247

Add webpage in a web site utilizing C#, asp.web in visible studio.. Add webpage in a web site utilizing asp.web and C# language utilizing visible studio software.

on this part you’ll be taught that how can we add a webpage in a web site utilizing GUI or graphical person interface of visible.

1. Asp.web Designing facet file coding for including a brand new webpage to a web site. Full Coding

Asp.web Coding facet file for including a brand new webpage to a web site. Full Coding

Add webpage in a website using C#, asp.net in visual studio.
The way to add new webpage

Coding Facet for asp.web

utilizing System;
utilizing System.Collections.Generic;
utilizing System.Linq;
utilizing System.Internet;
utilizing System.Internet.UI;
utilizing System.Internet.UI.WebControls;
utilizing System.Knowledge;
utilizing System.Knowledge.Sql;
utilizing System.Knowledge.SqlClient;

public partial class admin_addNewpages : System.Internet.UI.Web page
{
protected void Page_Load(object sender, EventArgs e)
{
DateTime rightNow = DateTime.Now;
txt_date.Textual content = String.Format(“{0:d}”, rightNow);
}
protected void btn_insert_Click(object sender, EventArgs e)
{
String str = System.Configuration. ConfigurationManager. ConnectionStrings [“con_str”]. ConnectionString;
SqlConnection con = new SqlConnection(str);
SqlCommand cmd = new SqlCommand();
con.Open();

cmd.Connection = con;
cmd.CommandText = “insert into webpages ( page_Title, page_descr, page_Detail, page_Loc, page_Logo, page_Banner, page_date) values (‘” + txt_pageTitle.Textual content + “‘ , ‘” + txt_pDescr.Textual content + “‘ , ‘” + txt_pDetail.Textual content + “‘ , ‘” + drp_loc.SelectedValue + “‘ ,'” + FileUpload_pLogo.FileName + “‘ , ‘” + FileUpload_pBanner.FileName + “‘, ‘”+txt_date.Textual content+”‘) “;

cmd.ExecuteNonQuery();
int i = cmd.ExecuteNonQuery();
if (i == 1)
{
Response.Write(“Rcord inserted Efficiently”);
Response.Redirect(“webPages.aspx”);
}
else
{
Response.Write(“Rcord Not inserted plz Attempt Once more”);
// Response.Redirect (“webPages.aspx.aspx”);
}
}
}

Leave A Reply

Your email address will not be published.