Monday, September 21, 2026

Email programming with APP Password

 EMAIL LIBRARY INCLUDE 


using System.Net.Mail;


            



Send Button Code 

{


            MailMessage mailMessage = new MailMessage(); //set the Mail Property to,from,body

            SmtpClient stp = new SmtpClient(); // set the credential

            mailMessage.To.Add(txtemail.Text);

            mailMessage.From = new MailAddress("YOUR EMAIL ID");

            mailMessage.Subject = "OTP Verification -  Demo Session Registration";


            mailMessage.Body = @"

                <html>

                <head></head>

                <body style='font-family:Arial, Helvetica, sans-serif; font-size:14px;'>


                <p>Dear Student,</p>


                <p>

                Thank you for registering for the <b>Yoga Demo Session</b> with

                <b>Globeyog</b>.

                </p>


                <p>

                To complete your registration, please verify your email address using the

                One-Time Password (OTP) below:

                </p>


                <p style='font-size:20px; color:#0066CC;'>

                <b>Your OTP: " + n.ToString() + @"</b>

                </p>


                <p>

                This OTP is valid for <b>10 minutes</b>.

                Please do not share it with anyone.

                </p>


                <p>

                If you did not request this registration, please ignore this email.

                </p>


                <p>

                Thank you for choosing <b>Globeyog</b>.

                We look forward to welcoming you to the Yoga Demo Session.

                </p>


                <br />


                <p>

                Regards,<br /><br />


                 


                <b>Team Globeyog</b><br />


               

                <br />


               


                </p>


                </body>

                </html>";





            mailMessage.IsBodyHtml = true;

            //smtpClient.Send(mailMessage);




            stp.Host = "smtp.gmail.com"; // host is reprensenting mail server

            stp.Credentials = new System.Net.NetworkCredential("youremailid@gmail.com", "APP PASSWORD");

            stp.EnableSsl = true; //sucessful send message server security licences

            // send your mail using send()

            stp.Send(mailMessage);






}


Sunday, September 20, 2026

FIND DATE BETWEEN TWO DATE START AND END

  DateTime startDate;

        DateTime endDate;


        bool isStartValid = DateTime.TryParseExact(

            lblstartdate.Text,

            "dd/MM/yyyy",

            CultureInfo.InvariantCulture,

            DateTimeStyles.None,

            out startDate);


        bool isEndValid = DateTime.TryParseExact(

            lblenddate.Text,

            "dd/MM/yyyy",

            CultureInfo.InvariantCulture,

            DateTimeStyles.None,

            out endDate);



        if (isStartValid && isEndValid)

        {

            DateTime currentDate = DateTime.Today;


            if (currentDate >= startDate && currentDate <= endDate)

            {

                lnkEdit.Visible = true; // show offer button 

            }

            else

            {

                lnkEdit.Visible = true; // hide offer button 

            }

        }

Monday, September 14, 2026

Gridview Pagining

 <asp:GridView ID="GridView1" runat="server" 

         
AutoGenerateColumns="False" 

AllowPaging="True" 

OnPageIndexChanging="GridView1_PageIndexChanging">


Code in C#

protected void BindProducts()
    {

        string cs =@"path";
        cn = new SqlConnection(cs);
        cn.Open();
        
        DataSet ds = new DataSet();
        string k = "select * from student";     
       SqlDataAdapter adp = new SqlDataAdapter (k,cn);
        adp.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }


protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {

        GridView1.PageIndex = e.NewPageIndex;

        BindProducts();

    }

Sunday, September 6, 2026

Saturday, September 5, 2026

GRIDVIEW DISPLAY TEXT IN PARAGRAPH

   <asp:TemplateField HeaderText="Message">


                      <ItemTemplate>


                        <div style=" width: 100%;

                                max-width: 900px;

                                font-size: 13px;

                                line-height: 1.7;

                                white-space: normal;

                                overflow-wrap: break-word;

                                word-wrap: break-word;

                                text-align: justify;">


                            <%# Eval("message") %> 


                        </div>


                          

                          

                    </ItemTemplate>


                 </asp:TemplateField>


Email programming with APP Password

 EMAIL LIBRARY INCLUDE  using System.Net.Mail;              Send Button Code  {             MailMessage mailMessage = new MailMessage(); //s...