Friday, February 26, 2010

View Profile Use of Data reader

 void displaympdetails()
    {

        conn.Open();
        string strQuery = "Select * from tbl_test where id='" + Request.Params.Get("id") + "'";
        cmd = new SqlCommand(strQuery, conn);
        dr = cmd.ExecuteReader();
        try
        {
            if (dr.Read())
            {
                lbldomain.Text = dr["domainname"].ToString();
                lblname.Text = dr["customername"].ToString();
                Session["customername"] = dr["customername"].ToString();
                lblconame.Text = dr["companyname"].ToString();
                lblmobile.Text = dr["contactno"].ToString();
            }
        }
        finally
        {
            conn.Close();
        }
        conn.Open();

        string strQuery1 = "Select * from tbl_customermaster where name='" + Session["customername"]+ "'";
        cmd = new SqlCommand(strQuery1, conn);
        dr = cmd.ExecuteReader();
        try
        {
            if (dr.Read())
            {
                lblphone.Text = dr["phone"].ToString();
                lbladdress.Text = dr["address"].ToString();
                lblemail.Text = dr["email"].ToString();
                lblbccemail.Text = dr["bccemail"].ToString();
                lblccemail.Text = dr["ccemail"].ToString();
            }
        }
        finally
        {
            conn.Close();
        }
    }

nice CSS

body
{
    background-image: url(../images/bg_light.gif);
    margin: 0;
}
.content_home
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 20px;
    color: #333;
    text-decoration: none;
}
.errmsg1
{
    padding: 7px;
    text-align: right;
    font-family: Verdana,Tahoma;
    font-size: 11px;
    color: Red;
}

.red_text
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: bold;
    color: #C7160C;
    text-decoration: none;
    text-transform: none;
}
a:link
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: black;
    text-decoration: none;
}
a:hover
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: Orange;
    text-decoration: none;
    font-weight:bold;
}
a:active
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #069;
    text-decoration: none;
}

.table_heading
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #666;
    text-decoration: none;
}

.heading
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #5b5b5b;
    text-decoration: none;
}

.txtcontent
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #5b5b5b;
    text-decoration: none;
    border-color: #666;
    border-style: dashed;
    border-width: 0 0 1px;
}

.textfield
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: normal;
    color: #000000;
    text-decoration: none;
    border: 1px solid #999999;
}
.textradio
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: normal;
    color: #000000;
    text-decoration: none;
}
.sub_red_heading
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #8C8C8C;
    text-decoration: none;
}
.td_border {
    border-top-width: 0px;
    border-right-width: 0px;
    border-bottom-width: 1px;
    border-left-width: 0px;
    border-top-style: dashed;
    border-right-style: dashed;
    border-bottom-style: dashed;
    border-left-style: dashed;
    border-top-color: #666666;
    border-right-color: #666666;
    border-bottom-color: #666666;
    border-left-color: #666666;
}
.table_sub_heading {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    color: #666666;
    text-decoration: none;
}

.red_heading
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #e0581d;
    text-decoration: none;
}

.small_heading
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #FF9;
    text-decoration: none;
}
.small_heading1
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: Black;
    text-decoration: none;
}
.sub_heading
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #69C;
    text-decoration: none;
}

.blue_content
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #316A95;
    text-decoration: none;
}

.td_border
{
    border-color: #666;
    border-style: dashed;
    border-width: 0 0 1px;
}

.td_border_heading
{
    border: 1px outset #666;
}

.table_sub_heading
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: #666;
    text-decoration: none;
}

.inputbutton
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;
    color: #FFF;
    text-decoration: none;
    background-color: #F90;
    height: 20px;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    border-style: none;
    padding: 2px;
}
.inputbutton1
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 20px;
    color: #cccccc;
    text-decoration: underline;
}

.gray_border
{
    border: 1px solid #999;
}

.compnay_name
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #CCC;
    text-decoration: none;
    text-transform: capitalize;
    letter-spacing: 2px;
}

.welcome_and_date
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #FFF;
    text-decoration: none;
    text-transform: none;
    letter-spacing: 1px;
    font-weight: 700;
}

.Error
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: red;
    text-decoration: blink;
    font-weight: 700;
}

.blue_dots_hor
{
    background-image: url(images/blue_dots_hor.gif);
    background-repeat: repeat-y;
    background-position: center top;
}

.content,
a:visited
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #333;
    text-decoration: none;
}
body {
    background-image: url(../images/bg_light.gif);
    margin-bottom: 0px;
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 0px;
}
.content {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #333333;
    text-decoration: none;
}

.table_heading {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #666666;
    text-decoration: none;
}
.td_border {
    border-top-width: 0px;
    border-right-width: 0px;
    border-bottom-width: 1px;
    border-left-width: 0px;
    border-top-style: dashed;
    border-right-style: dashed;
    border-bottom-style: dashed;
    border-left-style: dashed;
    border-top-color: #666666;
    border-right-color: #666666;
    border-bottom-color: #666666;
    border-left-color: #666666;
}

.td_border_heading {
    border: 1px outset #666666;
}

.table_sub_heading {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    font-weight: bold;
    color: #666666;
    text-decoration: none;
}
.inputbutton {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #FFFFFF;
    text-decoration: none;
    background-color: #FF9900;
    height: 15px;
    width: 50px;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    padding: 2px;
    border-top-style: none;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
}
.compnay_name {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #CCCCCC;
    text-decoration: none;
    text-transform: capitalize;
    letter-spacing: 2px;
}
.welcome_and_date {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #FFFFFF;
    text-decoration: none;
    text-transform: none;
    letter-spacing: 1px;
    font-weight: bold;
    }
    .Error {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #FF0000;
    text-decoration: blink;
    font-weight: bold;
}
.dropmenudiv
{
height: 300px;
max-height: 300px;
overflow-y: scroll;
}
a.red:visited {color:#FF0000;font-style:italic}

.label
{
    font-family:Verdana,Tahoma;
    font-size:11px;
    font-weight:bold;
    color:Red;
    }

Send Automatic Email

Craete Email Sending Page like This:

autoemail .aspx

             strmailmsg.Append("<html><title></title><meta http-equiv='Content-Type' content='text/html;      charset=iso-8859-1'>");
            strmailmsg.Append("<body><script type='text/javascript'>");
            strmailmsg.Append("var AdBrite_Title_Color = '0000FF';");
            strmailmsg.Append("var AdBrite_Text_Color = '000000';");
            strmailmsg.Append("var AdBrite_Background_Color = 'FFFFFF';");
            strmailmsg.Append("var AdBrite_Border_Color = 'CCCCCC';");
            strmailmsg.Append("var AdBrite_URL_Color = '008000';");
            strmailmsg.Append("try{var AdBrite_Iframe=window.top!=window.self?2:1;var );
            strmailmsg.Append("document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){");
            strmailmsg.Append("var AdBrite_Iframe='';var AdBrite_Referrer='';}");
            strmailmsg.Append("</script>");
            strmailmsg.Append("<script type='text/javascript'>document.write(String.fromCharCode(60,83,67,82,73,80,84));document.");
            strmailmsg.Append("write(' src='zs=3330305f323530&ifr='+");
            strmailmsg.Append("AdBrite_Iframe+'&ref='+AdBrite_Referrer+'' type='text/javascript'>');document.write(String.");
            strmailmsg.Append("fromCharCode(60,47,83,67,82,73,80,84,62));</script>");
            strmailmsg.Append("<div><a target='_top' href='/purchase_form.php?opid=1515036&afsid=1> Click Here </a></div");
            strmailmsg.Append("</body></html>");
                MailMessage msg = new MailMessage();
                msg.Body = strmailmsg.ToString();
                msg.From = "Do_Not_Reply@sfdpl.com";
                msg.Subject = "Consolidated Renewl Remainder";
                msg.BodyFormat = MailFormat.Html;
                msg.Priority = MailPriority.Normal;
                System.Web.Mail.SmtpMail.SmtpServer = "";
                //msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 587);
                //msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2);
                //msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1);
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",     );
                msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", );
                msg.To = "";
                msg.Bcc = "";
                System.Web.Mail.SmtpMail.Send(msg);
                msg = null;
                mail = null;

Then Webmaster Schedule in Your Ftp Accout 

Set Time And Day For Scheduling

Thn Its Work

Tuesday, February 2, 2010

Use of three dropdown in Ajax

<asp:UpdatePanel id=”UpdatePanel1″ runat=”server” UpdateMode=”Conditional”>
<contenttemplate>
<asp:DropDownList width=”250px”  id=”drpmaincategory” runat=”server” OnSelectedIndexChanged=”drpmaincategory_SelectedIndexChanged” AutoPostBack=”true” >
</asp:DropDownList>  <asp:RequiredFieldValidator ID=”RequiredFieldValidator3″ runat=”server”
ControlToValidate=”drpmaincategory” ErrorMessage=”Please Select Category” Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblmaincategory” runat=”server” Text=”"></asp:Label></TD>
<asp:DropDownList id=”drpsubcategory” width=”250px” runat=”server” OnSelectedIndexChanged=”drpsubcategory_SelectedIndexChanged1″ AutoPostBack=”true” CssClass=”textfield”>
</asp:DropDownList> <asp:RequiredFieldValidator ID=”RequiredFieldValidator2″ runat=”server”
ControlToValidate=”drpsubcategory” ErrorMessage=”Please Select Subcategory”
Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblsubcategory” runat=”server” Text=”"></asp:Label></TD>
<asp:DropDownList id=”drpproductname” width=”250px” runat=”server”>
</asp:DropDownList><asp:RequiredFieldValidator ID=”RequiredFieldValidator1″ runat=”server”
ControlToValidate=”drpproductname” ErrorMessage=”Please Select Product”
Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblproduct” runat=”server” Text=”"></asp:Label></TD>
</contenttemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID=”drpmaincategory” EventName=”SelectedIndexChanged” />
<asp:AsyncPostBackTrigger ControlID=”drpsubcategory” EventName=”SelectedIndexChanged” />
</triggers>
</asp:UpdatePanel>

Use of three dropdown in Ajax

<asp:UpdatePanel id=”UpdatePanel1″ runat=”server” UpdateMode=”Conditional”>
<contenttemplate>

<asp:DropDownList width=”250px”  id=”drpmaincategory” runat=”server” OnSelectedIndexChanged=”drpmaincategory_SelectedIndexChanged” AutoPostBack=”true” >
</asp:DropDownList>  <asp:RequiredFieldValidator ID=”RequiredFieldValidator3″ runat=”server”
ControlToValidate=”drpmaincategory” ErrorMessage=”Please Select Category” Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblmaincategory” runat=”server” Text=”"></asp:Label></TD>

<asp:DropDownList id=”drpsubcategory” width=”250px” runat=”server” OnSelectedIndexChanged=”drpsubcategory_SelectedIndexChanged1″ AutoPostBack=”true” CssClass=”textfield”>
</asp:DropDownList> <asp:RequiredFieldValidator ID=”RequiredFieldValidator2″ runat=”server”
ControlToValidate=”drpsubcategory” ErrorMessage=”Please Select Subcategory”
Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblsubcategory” runat=”server” Text=”"></asp:Label></TD>

<asp:DropDownList id=”drpproductname” width=”250px” runat=”server”>
</asp:DropDownList><asp:RequiredFieldValidator ID=”RequiredFieldValidator1″ runat=”server”
ControlToValidate=”drpproductname” ErrorMessage=”Please Select Product”
Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblproduct” runat=”server” Text=”"></asp:Label></TD>

</contenttemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID=”drpmaincategory” EventName=”SelectedIndexChanged” />
<asp:AsyncPostBackTrigger ControlID=”drpsubcategory” EventName=”SelectedIndexChanged” />
</triggers>
</asp:UpdatePanel>

Code Behind the Ajax Control

f (! IsPostBack) { hid_Ticker.Value = new TimeSpan(0, 0, 0).ToString(); } Next, we create the Tick handler, which will retrieve the current time from the HiddenField, add one second to it, and display it in the Literal field, then it will save the new value to the HiddenField to be used again in a second: protected void Timer1_Tick(object sender, EventArgs e) { hid_Ticker.Value = TimeSpan.Parse(hid_Ticker.Value).Add(new TimeSpan(0, 0, 1)).ToString(); lit_Timer.Text = “Time spent on this page: ” + hid_Ticker.Value.ToString(); } Because AJAX is native to ASP.NET 3.5, we do not need to add anything extra or reference any other namespaces. All we simply need to do is include the ScriptManager and UpdatePanel controls, ASP.NET takes care of everything else for you behind the scenes. If we run this now the timer will begin counting up as soon as the page is loaded. It is already fully-functional. But to test it, let’s add a textbox and a button so that we can postback the page and demonstrate how to keep the timer counting up regardless. Finally, we add the logic to the code-behind that will handle the button click event: protected void btn_Submit_Click(object sender, EventArgs e) { lit_Name.Text = “Thanks. Your name is: ” + fld_Name.Text; } Now when we run this, you will see that we’re able to submit our name without the timer stopping or pausing or restarting. Our ASPX page looks like this: using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (! IsPostBack) { hid_Ticker.Value = new TimeSpan(0, 0, 0).ToString(); } } protected void Timer1_Tick(object sender, EventArgs e) { hid_Ticker.Value = TimeSpan.Parse(hid_Ticker.Value).Add(new TimeSpan(0, 0, 1)).ToString(); lit_Timer.Text = “Time spent on this page: ” + hid_Ticker.Value.ToString(); } protected void btn_Submit_Click(object sender, EventArgs e) { lit_Name.Text = “Thanks. Your name is: ” + fld_Name.Text; } }