Friday, November 24, 2023

JAVA SCRIPT PASS TEXTBOX DATA TO FUNCTION PARAMETER

 <html>

<head>

<script language="JavaScript">


function display(name,m1,m2)

{


var total;

total=parseInt(m1)+ parseInt(m2);

document.write(name + "<br>"  + total );


}


</script>



</head>


<body>


enter your name :  <input type="text" id="t1"> <br>


enter your m1:  <input type="text" id="t2"> <br>


enter your m2:  <input type="text" id="t3"> <br>


<input type="button" value="submit" onclick="display(document.getElementById('t1').value , document.getElementById('t2').value ,  document.getElementById('t3').value ,  )">


</body>

</html>

Friday, November 3, 2023

HOW TO SEND BILL FORMAT TO MAIL BODY

 STEP 1  CREATE PANEL CONTROL 


STEP 2  UNDER PANEL CONTROL CREATE ALL  FORM  AND DESIGN 


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>


<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    

        <asp:Button ID="Button1" runat="server" Text="SHOW DATA" Width="157px" OnClick="Button1_Click" />

        &nbsp;

        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="SEND MAIL" Width="161px" />

&nbsp;

       

        <br />

        <br />

        <br />

    

   

          <asp:Panel ID="pnlContents" runat="server" style="border-style: ridge;padding:10px;">


               <h1>Customer Generate Bill </h1> <br />

               <address>Narula Business Center , Near Lokmat Square </address>

               <br />

               <b>Mobile No. 8411064860</b>

              <hr />


              <asp:FormView ID="FormView1" runat="server">


                  <ItemTemplate>

                      &nbsp;Student&nbsp; Information Details

                      <br />

                      <br />

                      &nbsp;



                       <b>Name of Customer : </b> <asp:Label ID="Label1" runat="server" Text='<%# Eval("name") %>'></asp:Label> <br />


                        <b>Customer City  : </b> <asp:Label ID="Label2" runat="server" Text='<%# Eval("city") %>'></asp:Label> <br />




                  </ItemTemplate>


              </asp:FormView>


          </asp:Panel> 


    </form>

</body>

</html>


===================  C#  Coading  ========================


using System.Data.SqlClient;

using System.IO;

using System.Net.Mail;


Coding  for  send  button 

protected void Button2_Click(object sender, EventArgs e)

    {

        //mail


        using (StringWriter sw = new StringWriter())

        {

            using (HtmlTextWriter hw = new HtmlTextWriter(sw))

            {


                pnlContents.RenderControl(hw);

                StringReader sr = new StringReader(sw.ToString());


                SmtpClient smtpClient = new SmtpClient("nrsolution4u-student.com", 25);


                smtpClient.Credentials = new System.Net.NetworkCredential("contact@nrsolution4u-student.com", "password");

                smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;


                MailMessage mailMessage = new MailMessage("contact@nrsolution4u-student.com", "nileshimp2015@gmail.com");

                mailMessage.Subject = "Domain Testing";

                mailMessage.Body = sw.ToString();



                mailMessage.IsBodyHtml = true;

                smtpClient.Send(mailMessage);

            }

        }


    }


=================== render  function important  =========================

 public override void VerifyRenderingInServerForm(Control control)
    {
        /* Verifies that the control is rendered */
    }









GRIDVIEW ON ROW DATA BOUND EVENT

 Database Create  Student : roll , name , city , cost  Fix 6 Value  in Database Record  ====================================================...