Sunday, May 31, 2009

Use Of Accordian in ASP.NET?

Design :

UpdatePanel ID="updateCustomer" runat="server"
ContentTemplate
asp:PlaceHolder ID="phCustomerTestimonial" runat="server asp:PlaceHolder
ContentTemplate
asp:UpdatePanel


Codding Part:
Accordion customerTestimonialsAccordion = new Accordion();


MemberService memberService = new MemberService();
MemberData.FeedbackDataTable feedback = new MemberData.FeedbackDataTable();
int i = 0;
customerTestimonialsAccordion.ID = "customerTestimonialsAccordion";
customerTestimonialsAccordion.SelectedIndex = 0;
customerTestimonialsAccordion.FadeTransitions = true;
customerTestimonialsAccordion.FramesPerSecond = 50;
customerTestimonialsAccordion.TransitionDuration = 250;
customerTestimonialsAccordion.SuppressHeaderPostbacks = true;
feedback = memberService.GetTestimonial();
DataView feedBackView = new DataView(feedback);
foreach (DataRowView feedbackRowView in feedback)
{
AccordionPane accordionPane = new AccordionPane();
LinkButton parentCustomerTestimonial =new LinkButton();
parentCustomerTestimonial.Text = feedbackRowView["FeedbackDescription"].ToString();
parentCustomerTestimonial.ID = feedbackRowView["FeedbackID"].ToString();
accordionPane.HeaderContainer.Controls.Add(parentCustomerTestimonial);
customerTestimonialsAccordion.Panes.Add(accordionPane);
i += 1;
}
phCustomerTestimonial.Controls.Add(customerTestimonialsAccordion);
}

Monday, May 25, 2009

How to handle events using java script?

function KeyPressed()
{
document.onkeydown = keydown;
function keydown(evt)
{
if (!evt)
evt = event;
if(evt.keyCode == 46 evt.keyCode == 8)
{
var value = document.getElementById('<%= txtValue.ClientID %>').value;
var show =parseInt(value );
if(show < 250)
{
document.getElementById('<%= txtValue.ClientID %>').innerText = show + 1;
}
}
else if(evt.keyCode != 37 evt.keyCode != 38 evt.keyCode != 39 evt.keyCode != 40)
{
var value = document.getElementById('<%= txtValue.ClientID %>').value;
var show = value-1;
document.getElementById('<%= txtValue.ClientID %>').innerText = show;
}
alert(evt.keyCode);
//return false;
}
}

Thursday, May 21, 2009

Open popup using string builder/in Server side:

StringBuilder Scr = new StringBuilder(); Scr.Append(""); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OpenFile", Scr.ToString());

Friday, May 15, 2009

Javascript for open popup in NewWindow:



function popUp(url, width, height) {
var intWidth=1000;
var intHeight=690;
var x='http://PersonalInformation.aspx';
if(width > 0) intWidth = width;
if(height > 0) intHeight = height;
var winPopUp = window.open(x + url,'popup','width=' + intWidth + ',height=' + intHeight + ',scrollbars,resizable,left=30,top=45');
if(typeof window.focus != 'undefined') javascript: winPopUp.focus();
}



PostBackUrl='javascript:popUp("",1024,600)'

Thursday, May 14, 2009

Javascript for email validation !

Javascript for email validation !


function check()
{
var elem= document.getElementById("txtEmail");
var str = elem.value;
var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
if (!str.match(re))
{
alert("Verify the e-mail address format.");
}
else
{
alert("Correct!");
}
}

Friday, May 8, 2009

Thursday, May 7, 2009

How to attach PDF when sending mail?

Attachment when sending mail :-
string attachment = Session["PdfFileName"].ToString();
Attachment att = new Attachment(attachment);
message.Attachments.Add(att);
SmtpClient emailClient = new SmtpClient(SMTPServer);