|
string path = "~/Image/" + FileUpload1.FileName.ToString();
FileUpload1.SaveAs(Server.MapPath("~/Image/")+FileUpload1.FileName.ToString());
|
|
|
|
|
void bind()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["productConnectionString1"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("select id,name,path from Table1 ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "table");
PagedDataSource page = new PagedDataSource();
page.AllowPaging = true;
page.DataSource = ds.Tables[0].DefaultView;
page.PageSize = 2;
page.CurrentPageIndex = CurrentPage;
DataList1.DataSource = page;
DataList1.DataBind();
con.Close();
}
public int CurrentPage
{
get
{
// look for current page in ViewState
object o = this.ViewState["_CurrentPage"];
if (o == null)
return 0; // default to showing the first page
else
return (int)o;
}
set
{
this.ViewState["_CurrentPage"] = value;
}
}
PREVIOUS PAGE
CurrentPage -= 1;
bind();
NEXT PAGE
CurrentPage += 1;
bind();
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=INFghdgfOTECH;Initial Catalog=yfgahoo;User ID=sa; Password=sa");
SqlCommand cmd = new SqlCommand("select fill_by, email,pacakage,pay_mode from register ", con);
con.Open();
//SqlDataReader dr=new SqlDataReader() ;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "register");
//dr=cmd .ExecuteReader ("register");
Repeater1.DataSource = ds.Tables["register"];
Repeater1.DataBind();
con.Close();
}
modified on Saturday, December 26, 2009 7:10 AM
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
Databind();
}
public void Databind()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select * from seven", con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "seven");
GridView2.DataSource = ds.Tables["seven"];
GridView2.DataBind();
con.Close();
PagedDataSource page = new PagedDataSource();
page.DataSource = ds.Tables["seven"].DefaultView ;
page.AllowPaging = true;
page.PageSize = 1;
page.CurrentPageIndex = currentpage;
GridView2.DataSource = page ;
GridView2.DataBind();
}
public int currentpage
{
get
{
// look for current page in ViewState
object o = this.ViewState["_CurrentPage"];
if (o == null)
return 0; // default to showing the first page
else
return (int)o;
}
set
{
this.ViewState["_CurrentPage"] = value;
}
}
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
currentpage -= 1;
DataBind();
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
currentpage += 1;
DataBind();
}
|
|
|
|
|
Add handler.ashx form -
string img = context.Request.QueryString["id"];
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooconnectionstring"].ConnectionString);
con .Open ();
SqlCommand cmd = new SqlCommand("select img from photo where id='" + img + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
context.Response.BinaryWrite((byte[])dr[0]);
con.Close();
context.Response.End();
and binding the image button(right click on image button) :-
"image.ashx?id="+Eval("id")
and open image in next form :-
protected void Page_Load(object sender, EventArgs e)
{
string img = Request.QueryString["id"];
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooconnectionstring"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("select img from photo where id='" + img + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
Response.BinaryWrite((byte[])dr[0]);
con.Close();
Response.End();
}
|
|
|
|
|
first bind the Grid View -
protected void Page_Load(object sender, EventArgs e)
{
BindData();
}
public void BindData()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select * from seven", con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "seven");
GridView1.DataSource = ds.Tables ["seven"];
GridView1.DataBind();
}
Then On button click_Event -
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=filename.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving than
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
Public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
}
|
|
|
|
|
first bind the Grid View -
protected void Page_Load(object sender, EventArgs e)
{
BindData();
}
public void BindData()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select * from seven", con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "seven");
GridView1.DataSource = ds.Tables ["seven"];
GridView1.DataBind();
}
|
|
|
|
|
protected void Button1_Click(object sender, EventArgs e)
{
string address = "callirfan_12@rediffmail.com";
MailMessage mm = new MailMessage(txt_email .Text,address );
mm.Subject = txt_subject.Text;
mm.Body = txt_body.Text;
//mm.Attachments.Add(new Attachment(AttachmentFile.PostedFile.InputStream, AttachmentFile.FileName));
Attachment attatchfile = new Attachment(AttachmentFile.PostedFile.InputStream, AttachmentFile.FileName);
mm.Attachments.Add(attatchfile);
//Attachment attatchfile = new Attachment(AttachmentFile );
//mm.Attachments.Add(attatchfile);
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Send(mm);
Response .Write ("Message sent Successfully..");
}
</configSections>
<system.net>
<mailSettings>
<smtp>
<network
host="mx.rediffmail.com."
port="25"
userName="sa"
password="sa" />
</smtp>
</mailSettings>
</system.net>
|
|
|
|
|
SmtpClient smtpclient = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromaddress = new MailAddress("support@euro-asianweddings.com", "Jayanti Popat");
MailAddress toaddress = new MailAddress("info", "Infotech");
message.From = fromaddress;
message.To.Add(toaddress);
message.IsBodyHtml = true;
message.Subject = "New Registration Alert s.com !";
message.Body = "New Registration one With E-mail ID:" + user_mail + "and User name : " + user_name;
smtpclient.Port = 25;
smtpclient.Host = "mx.infotechahm.com";
smtpclient.Send(message);
modified on Saturday, December 26, 2009 7:06 AM
|
|
|
|
|
try
{
SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromaddress = new MailAddress(txt_mail.Text, txt_name.Text);
message.From = fromaddress;
message.To.Add("irf@iehahm.com");
message.Subject = txt_subject.Text;
message.Body = txt_feedback.Text;
message.IsBodyHtml = false;
//message.IsBodyHtml = true;
smtp.Send(message);
Label1.Text = "Email successfully sent.";
}
catch (Exception ex)
{
Label1.Text = "send Email Failed." + ex.Message;
}
modified on Saturday, December 26, 2009 7:06 AM
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
public void BindData()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
////SqlCommand cmd = new SqlCommand("select id as ID,store_name as StoreName,sales as Sales,date as Date from store_information", con);
SqlCommand cmd = new SqlCommand("select * from store_information", con);
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "store_information");
GridView1.DataSource = ds.Tables["store_information"];
GridView1.DataBind();
con.Close();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
BindData();
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//string textbox1 = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].FindControl("textbox1")).Text .ToString ();
string textbox2 = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].FindControl("textbox2")).Text .ToString ();
string textbox3 = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].FindControl("textbox3")).Text .ToString ();
string textbox4 = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].FindControl("textbox4")).Text .ToString ();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
//cmd.CommandText = "UPDATE store_information SET id ='" + textbox1.Text + "',store_name ='" + textbox2.Text + "',sales ='" + textbox3.Text + "',date ='" + textbox4.Text + "' WHERE id='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";
//cmd.CommandText = "UPDATE store_information SET id = + textbox1.Text + ,store_name ='" + textbox2.Text + "',sales ='" + textbox3.Text + "',date ='" + textbox4.Text + "' WHERE id='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";
cmd .CommandText ="UPDATE store_information SET store_name='" + textbox2 .ToString () + "',sales='" + textbox3 .ToString () + "',date='" + textbox4 .ToString () + "' where id='" + GridView1 .DataKeys [e.RowIndex ].Values[0].ToString () + "'";
con.Open();
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
BindData();
con.Close();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
BindData();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
BindData();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.Equals("AddNew"))
{
string text_store = ((TextBox)GridView1.FooterRow.FindControl("text_store")).Attributes .Add("onkeypress","return validate()").Text.ToString();
string txt_sales = ((TextBox)GridView1.FooterRow.FindControl("txt_sales")).Text.ToString();
string txt_date = ((TextBox)GridView1.FooterRow.FindControl("txt_date")).Text.ToString();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
//cmd.CommandText = "UPDATE store_information SET id ='" + textbox1.Text + "',store_name ='" + textbox2.Text + "',sales ='" + textbox3.Text + "',date ='" + textbox4.Text + "' WHERE id='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";
//cmd.CommandText = "UPDATE store_information SET id = + textbox1.Text + ,store_name ='" + textbox2.Text + "',sales ='" + textbox3.Text + "',date ='" + textbox4.Text + "' WHERE id='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";
cmd.CommandText = "INSERT INTO store_information (store_name,sales,date) VALUES('" + text_store.ToString() + "','" + txt_sales.ToString() + "','" + txt_date.ToString() + "')";
con.Open();
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
BindData();
con.Close();
}
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "DELETE FROM store_information WHERE id='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";
con.Open();
cmd.ExecuteNonQuery();
BindData();
con.Close();
}
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack )
{
this.Binddata();
}
}
public void Binddata()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString1"].ConnectionString);
//SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
SqlCommand cmd=new SqlCommand ("select * from store_information",con );
con .Open ();
SqlDataAdapter DA=new SqlDataAdapter (cmd);
DataSet ds=new DataSet ();
DA.Fill (ds,"store_information");
DataList1 .DataSource =ds.Tables["store_information"];
DataList1 .DataBind ();
PagedDataSource page=new PagedDataSource() ;
page.AllowPaging = true;
page.DataSource = ds.Tables["store_information"].DefaultView ;
page.PageSize = 1;
page.CurrentPageIndex = currentpage;
ViewState["TotalPages"] = page.PageCount;
this.lblPageInfo.Text = + (currentpage + 1) + "/" + page.PageCount;
this.lbtnPrevious.Enabled = !page.IsFirstPage;
this.lbtnNext.Enabled = !page.IsLastPage;
this.lbtnFirst.Enabled = !page.IsFirstPage;
this.lbtnLast.Enabled = !page.IsLastPage;
DataList1.DataSource = page;
DataList1.DataBind();
}
public int currentpage
{
get
{
object obj = this.ViewState["_currentpage"];
int _currentpage = 0;
if (obj == null)
{
_currentpage = 0;
}
else
{
_currentpage = (int)obj;
}
return _currentpage ;
}
set
{
ViewState["_currentpage"] = value ;
}
}
public int fistIndex
{
get
{
int _FirstIndex = 0;
if (ViewState["_FirstIndex"] == null)
{
_FirstIndex = 0;
}
else
{
_FirstIndex = Convert.ToInt32(ViewState["_FirstIndex"]);
}
return _FirstIndex;
}
set { ViewState["_FirstIndex"] = value; }
}
public int lastIndex
{
get
{
int _LastIndex = 0;
if (ViewState["_LastIndex"] == null)
{
_LastIndex = 0;
}
else
{
_LastIndex = Convert.ToInt32(ViewState["_LastIndex"]);
}
return _LastIndex;
}
set { ViewState["_LastIndex"] = value; }
}
private void doPaging()
{
DataTable dt = new DataTable();
dt.Columns.Add("PageIndex");
dt.Columns.Add("PageText");
fistIndex = currentpage - 5;
if (currentpage > 5)
{
lastIndex = currentpage + 5;
}
else
{
lastIndex = 10;
}
if (lastIndex > Convert.ToInt32(ViewState["TotalPages"]))
{
lastIndex = Convert.ToInt32(ViewState["TotalPages"]);
fistIndex = lastIndex - 10;
}
if (fistIndex < 0)
{
fistIndex = 0;
}
for (int i = fistIndex; i < lastIndex; i++)
{
DataRow dr = dt.NewRow();
dr[0] = i;
dr[1] = i + 1;
dt.Rows.Add(dr);
}
this.DataList1 .DataSource = dt;
this.DataList1 .DataBind();
}
protected void lbtnFirst_Click(object sender, EventArgs e)
{
currentpage = 0;
this.Binddata();
}
protected void lbtnLast_Click(object sender, EventArgs e)
{
currentpage = (Convert.ToInt32(ViewState["TotalPages"]) - 1);
this.Binddata();
}
protected void lbtnNext_Click(object sender, EventArgs e)
{
currentpage += 1;
this.Binddata();
}
protected void lbtnPrevious_Click(object sender, EventArgs e)
{
currentpage -= 1;
this.Binddata();
}
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName.Equals("Paging"))
{
currentpage = Convert.ToInt16(e.CommandArgument.ToString());
this.Binddata();
}
}
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
LinkButton lnkbtnPage = (LinkButton)e.Item.FindControl("LinkButton1");
if (lnkbtnPage.CommandArgument.ToString() == currentpage.ToString())
{
lnkbtnPage.Enabled = false;
lnkbtnPage.Style.Add("fone-size", "14px");
lnkbtnPage.Font.Bold = true;
}
}
|
|
|
|
|
protected void Button1_Click(object sender, EventArgs e)
{
bool atLeastOneRowDeleted = false;
foreach (GridViewRow row in GridView1 .Rows)
{
CheckBox cbox = (CheckBox)row.FindControl("check_del");
if (cbox != null && cbox.Checked)
{
atLeastOneRowDeleted = true;
int id = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
}
if (cbox.Checked == true)
{
//Label5.Visible = false ;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString1"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "DELETE FROM store_information WHERE id='" + GridView1.DataKeys[row .RowIndex].Values[0].ToString() + "'";
con.Open();
cmd.ExecuteNonQuery();
Rebind();
con.Close();
Response.Write("<script> confirm('Are you sure you want to delete record ?')</script>");
}
else
{
Response.Write("<script> alert('Please Checked Selected Record !')</script>");
//Label5.Visible = true;
}
}
}
|
|
|
|
|
Label1.Text = OnlineActiveUsers.OnlineUsersInstance.OnlineUsers.UsersCount.ToString();
webconfig file :-
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="OnlineActiveUsers" type="OnlineActiveUsers.OnlineUsersModule"/>
</httpModules>
Global asax file :=
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
OnlineActiveUsers.OnlineUsersInstance.OnlineUsers.UpdateForUserLeave();
}
|
|
|
|
|
Label1.Visible = true;
Image16.Visible = true;
string ad = txt_to.Text.ToString();
try
{
SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromaddress = new MailAddress("support@m.com", txt_name.Text );
message.From = fromaddress;
//message.To.Add("ca@rediffmail.com");
message.To.Add(ad );
message.Subject = txt_subject.Text;
message.Body = txt_body.Text;
// Attachment attatchfile = new Attachment(FileUpload1 .PostedFile.InputStream, FileUpload1 .FileName);
// message.Attachments.Add(attatchfile);
message.IsBodyHtml = false;
//message.IsBodyHtml = true;
smtp.Host= "hm.com";
smtp.Port = 25;
smtp.UseDefaultCredentials = true;
smtp.Credentials = new System.Net.NetworkCredential("support@ertm.com", "16575767");
smtp.Send(message);
Label1.Text = "Your Feedback Successfully Sent.";
}
catch (Exception ex)
{
Label1.Text = "Send Feedback Failed." + ex.Message;
}
modified on Saturday, December 26, 2009 7:07 AM
|
|
|
|
|
string ad = "mailtoan@rediffmail.com";
string ad1 = "callrediffmail.com";
string ad2 = "ir@ibibo.com";
try
{
SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
MailAddress fromaddress = new MailAddress("suort@inhm.com");
message.From = fromaddress;
message.To.Add(ad);
message.CC.Add(ad1);
message.Bcc.Add(ad2);
message.Subject = "Project Sample";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
System.IO.StringWriter sw = new System.IO.StringWriter(sb);
Html32TextWriter htmltw = new Html32TextWriter(sw);
rpt1.RenderControl(htmltw);
string gridstr = sb.ToString();
message.Body = "Testing Email." + gridstr;
message.IsBodyHtml = true ;
//smtp.Host = "mail.pryjutrjfrd.com";
smtp.Host = "mx.ifghfhfm.com";
smtp.Port = 25;
smtp.UseDefaultCredentials = true;
//smtp.Credentials = new System.Net.NetworkCredential("suresh@rtytry.com", "1rty");
smtp.Credentials = new System.Net.NetworkCredential("supfghport@im.com", "1fghfh");
smtp.Send(message);
Response.Write("Your Feedback Successfully Sent.");
}
catch (Exception ex)
{
Response.Write("Send Feedback Failed." + ex.Message);
}
modified on Saturday, December 26, 2009 7:09 AM
|
|
|
|
|
where sector='" + Session["search_by"].ToString() + "' or sector2 like'" + Session["search_by"].ToString() + "%' or sector2 like'%" + Session["search_by"].ToString() + "' or sector2 like'%" + Session["search_by"].ToString() + "%' order by RNO asc
|
|
|
|
|
<a href="#" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://dynamicdrive.com');">Click here to make Orkut.com your default homepage</a>
***************
<A class=chlnk style="CURSOR: hand; font-decoration: underline" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.javascriptfreecode.com');"
href="http://www.javascriptfreecode.com"> Set Home Page</A><br><font face="Tahoma">
|
|
|
|
|
// Tree 3 parent nodes
SqlConnection con23 = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlstring"].ConnectionString);
SqlCommand cmd23 = new SqlCommand("select industry from industry id where id in(21,22,23,24,25,26,27,28,29,30)order by industry desc", con23);
DataSet ds23 = new DataSet("TreeView");
con23.Open();
SqlDataReader dr23 = cmd23.ExecuteReader();
//string currentNode = String.Empty;
//loop tru all MainSubject table columns and add these as ROOT NODES
while (dr23.Read())
{
TreeNode node23 = new TreeNode();
node23.Text = dr23[0].ToString();
TreeView3.Nodes.AddAt(0, node23);
//Child node
SqlConnection con123 = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlstring"].ConnectionString);
SqlCommand cmd123 = new SqlCommand("select subindustry from subindustry where industry='" + node23.Text.ToString() + "'order by subindustry desc", con123);
DataSet ds123 = new DataSet("TreeView");
con123.Open();
SqlDataReader dr123 = cmd123.ExecuteReader();
//loop tru all MainSubject table columns and add these as ROOT NODES
while (dr123.Read())
{
TreeNode node123 = new TreeNode();
node123.Text = dr123[0].ToString();
TreeView3.Nodes[0].ChildNodes.AddAt(0, node123);
node123.NavigateUrl = "~/Application/TreeView_serch.aspx?name=" + node123.Text.ToString() + "";
node123.CollapseAll();
//leaf nodes(Sub Child Node)
SqlConnection con1123 = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlstring"].ConnectionString);
SqlCommand cmd1123 = new SqlCommand("select product from product where subindustry='" + node123.Text.ToString() + "'order by product desc", con1123);
DataSet ds112 = new DataSet("TreeView");
con1123.Open();
SqlDataReader dr1123 = cmd1123.ExecuteReader();
//loop tru all MainSubject table columns and add these as ROOT NODES
while (dr1123.Read())
{
TreeNode node1123 = new TreeNode();
node1123.Text = dr1123[0].ToString();
TreeView3.Nodes[0].ChildNodes[0].ChildNodes.AddAt(0, node1123);
node1123.NavigateUrl = "~/Application/TreeView_serch_product.aspx?name=" + node1123.Text.ToString() + "";
}
dr1123.Close();
con1123.Close();
}
dr123.Close();
con123.Close();
}
dr23.Close();
con23.Close();
|
|
|
|
|
SqlConnection con23 = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlstring"].ConnectionString);
SqlCommand cmd23 = new SqlCommand("select industry from industry id where id in(21,22,23,24,25,26,27,28,29,30)order by industry desc", con23);
DataSet ds23 = new DataSet("TreeView");
con23.Open();
SqlDataReader dr23 = cmd23.ExecuteReader();
//string currentNode = String.Empty;
//loop tru all MainSubject table columns and add these as ROOT NODES
while (dr23.Read())
{
TreeNode node23 = new TreeNode();
node23.Text = dr23[0].ToString();
TreeView3.Nodes.AddAt(0, node23);
//Child node
SqlConnection con123 = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlstring"].ConnectionString);
SqlCommand cmd123 = new SqlCommand("select subindustry from subindustry where industry='" + node23.Text.ToString() + "'order by subindustry desc", con123);
DataSet ds123 = new DataSet("TreeView");
con123.Open();
SqlDataReader dr123 = cmd123.ExecuteReader();
//loop tru all MainSubject table columns and add these as ROOT NODES
while (dr123.Read())
{
TreeNode node123 = new TreeNode();
node123.Text = dr123[0].ToString();
TreeView3.Nodes[0].ChildNodes.AddAt(0, node123);
node123.NavigateUrl = "~/Application/TreeView_serch.aspx?name=" + node123.Text.ToString() + "";
node123.CollapseAll();
//leaf nodes(Sub Child Node)
SqlConnection con1123 = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlstring"].ConnectionString);
SqlCommand cmd1123 = new SqlCommand("select product from product where subindustry='" + node123.Text.ToString() + "'order by product desc", con1123);
DataSet ds112 = new DataSet("TreeView");
con1123.Open();
SqlDataReader dr1123 = cmd1123.ExecuteReader();
//loop tru all MainSubject table columns and add these as ROOT NODES
while (dr1123.Read())
{
TreeNode node1123 = new TreeNode();
node1123.Text = dr1123[0].ToString();
TreeView3.Nodes[0].ChildNodes[0].ChildNodes.AddAt(0, node1123);
node1123.NavigateUrl = "~/Application/TreeView_serch_product.aspx?name=" + node1123.Text.ToString() + "";
}
dr1123.Close();
con1123.Close();
}
dr123.Close();
con123.Close();
}
dr23.Close();
con23.Close();
|
|
|
|
|
Step 1:- Create Store procedure:-
ALTER PROCEDURE dbo.updateregister
@id int,
@fill_by nvarchar(50),
@email nvarchar(50),
@password nvarchar(50),
@gender nvarchar(50),
@pacakage nvarchar(50),
@pay_mode nvarchar(50)
AS
update register set fill_by=@fill_by,email=@email,password=@password,gender=@gender,pacakage=@pacakage,pay_mode=@pay_mode where id=@id
RETURN
|
|
|
|
|
public int update_register(int id, string fill_by, string email, string password, string gender, string pacakage, string pay_mode)
{
SqlConnection con = new SqlConnection(str);
SqlCommand cmd = new SqlCommand("updateregister", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection.Open();
cmd.Parameters.AddWithValue("@id", id);
cmd.Parameters.AddWithValue("@fill_by", fill_by);
cmd.Parameters.AddWithValue("@email", email);
cmd.Parameters.AddWithValue("@password", password);
cmd.Parameters.AddWithValue("@gender", gender);
cmd.Parameters.AddWithValue("@pacakage", pacakage);
cmd.Parameters.AddWithValue("@pay_mode", pay_mode);
return cmd.ExecuteNonQuery ();
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//DataList1.DataSource = bindlist();
DataList1.DataSource = DataBind();
DataList1.DataBind();
}
DataBind();
}
public DataTable DataBind()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["yahooConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("select id,fill_by,email,password,gender,pacakage,pay_mode from register ", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "register");
return ds.Tables["register"];
}
protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
{
Rock ab=new Rock() ;
int id = Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex].ToString());
string fill_by = ((DropDownList)e.Item.FindControl("DropdownList1")).SelectedItem.Text.ToString();
string email = ((TextBox)e.Item.FindControl("TextBox1")).Text;
string password = ((TextBox)e.Item.FindControl("TextBox2")).Text;
string gender = ((DropDownList)e.Item.FindControl("DropDownList2")).SelectedItem.Text.ToString();
string pacakage = ((DropDownList)e.Item.FindControl("DropDownList3")).SelectedItem.Text.ToString();
string pay_mode = ((DropDownList)e.Item.FindControl("DropDownList4")).SelectedItem.Text.ToString();
int result = ab.update_register(id, fill_by, email, password, gender, pacakage, pay_mode);
if (result > 0)
{
Response.Write("Update Succesfully.");
}
else
{
Response.Write("Not Update..");
}
DataList1.EditItemIndex = -1;
DataList1.DataSource = DataBind();
DataList1.DataBind();
}
protected void DataList1_CancelCommand(object source, DataListCommandEventArgs e)
{
DataList1.EditItemIndex = -1;
DataList1.DataSource = DataBind();
DataList1.DataBind();
}
protected void DataList1_EditCommand(object source, DataListCommandEventArgs e)
{
DataList1.EditItemIndex = e.Item.ItemIndex;
DataList1.DataSource = DataBind();
DataList1.DataBind();
}
|
|
|
|
|
Session id = System.Convert.ToInt32(Session["estimate_id"]);
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString);
{
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = con;
cmd1.CommandText = "select * from tender where estimate_id='" + id + "'";
cmd1.CommandType = CommandType.Text;
SqlDataAdapter adp1 = new SqlDataAdapter();
adp1.SelectCommand = cmd1;
DataSet1 ds1 = new DataSet1();
adp1.Fill(ds1, "tender");
ReportDocument rpt1 = new ReportDocument();
rpt1.Load(Server.MapPath("CrystalReport1.rpt"));
rpt1.SetDataSource(ds1);
CrystalReportViewer1.ReportSource = rpt1;
CrystalReportViewer1.Visible = true;
}
|
|
|
|
|
Rock d = new Rock () ;
string father_name = TextBox8.Text;
string father_occupation = TextBox13.Text;
string mother_name = TextBox9.Text;
string mother_occupation = TextBox14.Text;
string brother = DropDownList33.SelectedItem.Text;
string brother_married = DropDownList35.SelectedItem.Text;
string sister = DropDownList34.SelectedItem.Text;
string sister_married = DropDownList36.SelectedItem .Text ;
int result=d.save_submit(father_name ,father_occupation ,mother_name ,mother_occupation ,brother ,brother_married ,sister ,sister_married );
if (result > 0)
{
Response.Write("successprofile.aspx");
}
else
{
Response.Write("notsuccess.aspx");
}
}
|
|
|
|
|