Click here to Skip to main content
15,892,005 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Code for page ranking Pin
Peace ON4-Jun-10 19:59
Peace ON4-Jun-10 19:59 
GeneralRe: Code for page ranking Pin
Sandeep Mewara4-Jun-10 20:06
mveSandeep Mewara4-Jun-10 20:06 
GeneralRe: Code for page ranking Pin
Peace ON4-Jun-10 21:12
Peace ON4-Jun-10 21:12 
RantRe: Code for page ranking Pin
saini arun4-Jun-10 20:03
saini arun4-Jun-10 20:03 
Questionhow to restrict the user not to redirect to other page when check box is checked in asp.net with c# Pin
developerit4-Jun-10 19:08
developerit4-Jun-10 19:08 
AnswerRe: how to restrict the user not to redirect to other page when check box is checked in asp.net with c# Pin
Peace ON4-Jun-10 19:52
Peace ON4-Jun-10 19:52 
AnswerRe: how to restrict the user not to redirect to other page when check box is checked in asp.net with c# [modified] Pin
Ankur\m/4-Jun-10 21:32
professionalAnkur\m/4-Jun-10 21:32 
Questionhow to send all pages from gridview control to email using asp.net with c# Pin
developerit4-Jun-10 19:00
developerit4-Jun-10 19:00 
hi , iam using asp.net with c#


iam sending gridview data in a mail ,but when gridview having many records in pages then, only first page is send in email and other pages are not send , can you correct my code how to send all data in a mail

public override void VerifyRenderingInServerForm(Control control)
    {
       
    }

private string GridViewToHtml(GridView gv)
  {
      StringBuilder sb = new StringBuilder();
      StringWriter sw = new StringWriter(sb);
      HtmlTextWriter hw = new HtmlTextWriter(sw);

      gv.RenderControl(hw);
      return sb.ToString();
  }

protected void Button3_Click(object sender, EventArgs e)
  {
      //checkout

      if (txtgrandtotal.Text == "")
      {
          //click on total button
          clsdataset.ShowAlertMessage("please click addbutton");


      }
      else
      {


          SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["InventoryConnectionString"].ConnectionString);

          string note = TextBox2.Text;
          Session["note"] = note.ToString();

          CheckBox cc; Label id; Label categorynamee; Label itemkey; Label itemkeynamee; Label currentqty; Label salesprice;
          Label quantity; Label total;
          foreach (GridViewRow rr in GridView1.Rows)
          {
              cc = (CheckBox)rr.FindControl("chk");
              id = (Label)rr.FindControl("Label2");
              categorynamee = (Label)rr.FindControl("Label3");

              itemkey = (Label)rr.FindControl("Label4");

              itemkeynamee = (Label)rr.FindControl("Label5");

              currentqty = (Label)rr.FindControl("Label6");

              salesprice = (Label)rr.FindControl("Label7");

              quantity = (Label)rr.FindControl("Label8");

              total = (Label)rr.FindControl("Label1");


              Session["Orderno"] = id.Text;
              if (cc.Checked == true && cc.Visible == true)
              {
                  //update tblorder

                  SqlCommand cmdupd = new SqlCommand("addnotesproc", con1);
                  con1.Open();
                  cmdupd.CommandType = CommandType.StoredProcedure;
                  cmdupd.Parameters.AddWithValue("@OrderNo", Convert.ToInt32(id.Text));
                  cmdupd.Parameters.AddWithValue("@Note", TextBox2.Text);
                  cmdupd.ExecuteNonQuery();

                  con1.Close();

                  //insert  TblDetails

                  SqlCommand cmptbldetails = new SqlCommand("Addorderdetails", con1);
                  cmptbldetails.CommandType = CommandType.StoredProcedure;
                  con1.Open();

                  cmptbldetails.Parameters.AddWithValue("@OrderNo",Convert.ToInt32(id.Text));
                  cmptbldetails.Parameters.AddWithValue("@CategoryNameE",categorynamee.Text);
                  cmptbldetails.Parameters.AddWithValue("@ItemKey",itemkey.Text);
                  cmptbldetails.Parameters.AddWithValue("@ItemKeyNameE",itemkeynamee.Text);


                  cmptbldetails.Parameters.AddWithValue("@CurrentQTY",currentqty.Text);
                  cmptbldetails.Parameters.AddWithValue("@SalesPrice",salesprice.Text);
                  cmptbldetails.Parameters.AddWithValue("@Quantity",quantity.Text);
                  cmptbldetails.Parameters.AddWithValue("@Total",total.Text);
                  cmptbldetails.ExecuteNonQuery();
                  con1.Close();

              }



          }



          //updating tblorder




          //upto here
          System.Net.Mail.SmtpClient smtp = new SmtpClient();
          System.Net.Mail.MailMessage msg = new MailMessage();

          MailAddress fromaddress = new MailAddress("order@xyz.net");
          msg.From = fromaddress;

          string mailto = Session["Areamanager"].ToString();

          msg.To.Add(mailto);

          msg.Subject = "your Purchase Details";

          msg.Body = "ShopId::" + Session["UserName"].ToString() + "<br><br>" + "ShopName::" + Session["sendershopname"].ToString() + "<br><br>" + "OrderNo::" + Session["Orderno"].ToString() + "<br><br>" + "OrderDate::" + DateTime.Now.ToString() + "<br><br>" + "Total::" + Session["total"].ToString() + "<br><br>" + Session["note"].ToString() + "." + "<br><br>" + GridViewToHtml(GridView1);
          msg.IsBodyHtml = true;
          smtp.Host = "localHost";
          smtp.Port = 25;
          smtp.UseDefaultCredentials = true;

          smtp.Send(msg);




          Response.Redirect("mailsend.aspx");


      }

  }




i want to send all data from gridview ,can you correct my code which helps me
AnswerRe: how to send all pages from gridview control to email using asp.net with c# Pin
Peace ON4-Jun-10 19:43
Peace ON4-Jun-10 19:43 
Questiondatetime question Pin
Edward Topalian4-Jun-10 14:14
Edward Topalian4-Jun-10 14:14 
AnswerRe: datetime question Pin
Rutvik Dave4-Jun-10 14:24
professionalRutvik Dave4-Jun-10 14:24 
QuestionRe: datetime question Pin
Edward Topalian4-Jun-10 14:37
Edward Topalian4-Jun-10 14:37 
AnswerRe: datetime question Pin
Rutvik Dave4-Jun-10 15:51
professionalRutvik Dave4-Jun-10 15:51 
GeneralRe: datetime question Pin
Edward Topalian5-Jun-10 6:06
Edward Topalian5-Jun-10 6:06 
QuestionHow to make fixed header in gridView inside asp:panel? Pin
mittalpa4-Jun-10 8:34
mittalpa4-Jun-10 8:34 
AnswerRe: How to make fixed header in gridView inside asp:panel? Pin
Yusuf4-Jun-10 13:38
Yusuf4-Jun-10 13:38 
GeneralRe: How to make fixed header in gridView inside asp:panel? Pin
Sandeep Mewara4-Jun-10 20:07
mveSandeep Mewara4-Jun-10 20:07 
GeneralRe: How to make fixed header in gridView inside asp:panel? Pin
Yusuf5-Jun-10 11:38
Yusuf5-Jun-10 11:38 
GeneralRe: How to make fixed header in gridView inside asp:panel? Pin
Sandeep Mewara5-Jun-10 23:31
mveSandeep Mewara5-Jun-10 23:31 
AnswerRe: How to make fixed header in gridView inside asp:panel? Pin
Sandeep Mewara4-Jun-10 20:03
mveSandeep Mewara4-Jun-10 20:03 
QuestionDynamically setting width of controls Pin
mark_me4-Jun-10 8:25
mark_me4-Jun-10 8:25 
AnswerRe: Dynamically setting width of controls Pin
Peace ON4-Jun-10 22:57
Peace ON4-Jun-10 22:57 
QuestionWhat is photosynthesis example like bingmaps site Pin
somasekhara7774-Jun-10 8:23
somasekhara7774-Jun-10 8:23 
AnswerRe: What is photosynthesis example like bingmaps site Pin
T M Gray4-Jun-10 9:04
T M Gray4-Jun-10 9:04 
QuestionIs there a way to add source-structured inputs dynamically to html through c#? Pin
Member 39190494-Jun-10 5:48
Member 39190494-Jun-10 5:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.