Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, September 29, 2011

Option changes event

<

head>

<

style>

.important

{ background-color:yellow; } .sorta-important { background-color:lightyellow; }

</

style>

<title>Untitled Page</title>

</

head>

<

body>

<

select onchange="this.className=this.options[this.selectedIndex].className" class="important"> <option class="important" selected="selected">Item 1</option> <option class="sorta-important">Item 2</option> </select>

</

body>

</

html>

Saturday, September 17, 2011

ASP.NET TIPS: SENDING EMAIL USING ASP.NET (GMAIL OR YOUR SERVER)

  using System.Net.Mail;
using System.Net;

        MailMessage mail = new MailMessage();
        mail.To.Add("**@gmail.com");
        mail.To.Add("**@gmail.com");
        mail.From = new MailAddress("**@gmail.com");
        mail.Subject = "Email using Gmail";

        string Body = "Hi, this mail is to test sending mail from devenvexe" +
                      "using Gmail in ASP.NET";
        mail.Body = Body;

        mail.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
        smtp.Credentials = new System.Net.NetworkCredential
             ("***@gmail.com", "******");
        //Or your Smtp Email ID and Password
        smtp.EnableSsl = true;
        smtp.Send(mail);

Monday, September 12, 2011

Reset Controls Value using Asp.net / Javascript / J query


Reset Controls Value using Asp.net / Javascript / J query

Asp.net:

Dynamicaly you have to  add controls means you don't know controls id so we can find control type in particular page after we can reset the page if your using C#.net coding mean page will refersh ,or if you are using javascript /j query means page not refresh

C#.net Coding:

    protected void Button1_Click(object sender, EventArgs e)

    {

        ResetControl(this);

    }

    public void ResetControl(Control Parent)

    {

        foreach (Control c in Parent.Controls)

        {

          

                switch (c.GetType().ToString())

                {

                    case "System.Web.UI.WebControls.TextBox":

                        ((TextBox)c).Text = "";

                        break;

                    case "System.Web.UI.WebControls.CheckBox":

                        ((CheckBox)c).Checked = false;

                        break;

                    case "System.Web.UI.WebControls.RadioButton":

                        ((RadioButton)c).Checked = false;

                        break;

 

                }

            }

        }

 

Javascript:

 

You can add client event in button .

 

<script language="javascript" type='text/javascript'>

 

        function CLSEvent()

        {

              for (i=0; i<document.forms[0].length; i++)

              {

                    doc = document.forms[0].elements[i];

                    switch (doc.type)

                    {

                        case "text" :

                                doc.value = "";

                                break;

                          case "checkbox" :

                                doc.checked = false;

                                break;   

                          case "radio" :

                                doc.checked = false;

                                break;               

                          case "select-one" :

doc.options[doc.selectedIndex].selected = false;

                                break;                     

                          case "select-multiple" :

                                while (doc.selectedIndex != -1)

                                {

                                      indx = doc.selectedIndex;

                                      doc.options[indx].selected = false;

                                }

                                doc.selected = false;

                                break;

                                   

                          default :

                                break;

                    }

              }

        }

 

</script>

 

 

JQuery:

function clear_form_elements(ele) { 

     $(ele).find(':input').each(function() {  
         switch(this.type) { 

             case 'password': 

              case 'select-multiple': 

            case 'select-one': 

             case 'text': 

              case 'textarea': 

                $(this).val(''); 

                 break; 

             case 'checkbox': 

              case 'radio': 

                this.checked = false;

         }

     });

}

Saturday, September 3, 2011

Doubt on Indexer in C Sharp

Hi Sir,

I have doubt in indexer in c sharp. Can you explain me the
uses of indexer and example program with and without indexer. That
must be same program. Also need any real time example of indexer.


With Thanks & Regards,

J.Harishankaran

Mobile: 9677357493