Learning Curve…

Archive for May 2011

During development there’s an easier way to handle mail sent by your application: drop it in a folder on your local hard drive directly. To do this, create a folder like C:TempMail. You need to create the folder yourself because it won’t be created automatically. Then configure the <smtp /> element in web.config as follows:

<smtp deliveryMethod=”SpecifiedPickupDirectory”>

<specifiedPickupDirectory pickupDirectoryLocation=”C:TempMail” />

</smtp>

With these settings in web.config, your messages are not sent over the network, but are dropped as physical files (with an .eml extension) in the folder you configured in the pickupDirectoryLocation attribute. You can read these files with mail clients like Windows Mail (on Vista) or Windows Live Mail (which you can download from the Internet.

Some mail servers — like the one supplied by Gmail — require you to use SSL, a technique that encrypts the data going to the mail server to improve security. In ASP.NET prior to version 4, you had to enable SSL programmatically in your own code. Fortunately, with the inclusion of the enableSsl attribute on the <network /> element, this is no longer the case. To use a Gmail server or any other mail server that requires SSL, you use a <network /> element that looks like this:

<network enableSsl=”true” host=”smtp.gmail.com” password=”YourPassword” userName=”YourAccountName@gmail.com” />

Don’t forget to enter your password and user name — which in the case of Gmail is your full Gmail

e-mail address.

 By design, an ASP.NET page throws an exception whenever one of the controls on a page contains content that looks like HTML tags. For example when you enter

<h1>Hello World</h1> or <script type=”text/javascript”>alert(‘Hello World’);</script>

as  the contents for the comments text box in the your form.The ASP.NET runtime does this to prevent users from entering HTML or JavaScript that can potentially mess with the design or workings of your web site. If you’re sure you want to allow your users to enter HTML, you can disable request validation by setting the  ValidateRequest attribute in the

@ Page directive to False:

<%@ Page …. Inherits=”Contact” Title=”Contact Us” ValidateRequest=”False” %>

With this setting set to False, users can enter HTML without causing an error. Just make sure you really want to allow users to enter HTML when you set  ValidateRequest to False.

Add below code in in Page_Load

  ASPxGridLookup1.GridView.Width = ASPxGridLookup1.Width;

where ASPxGridLookup1 is ASPxGridLookup’s id.

Use the PostBackTrigger control to enable controls inside an updatePanel to cause a postback :-
You can add it in page design or code behind .

In Page Design


<Triggers>
<asp:PostBackTrigger ControlID=”UploadButton” />
</Triggers>

In Code Behind
ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(UploadButton);

Step  to get  value (id) of selected row in ASPxGridLookup  from the client side event : –

1 . Write a JavaScript function :

[JScript]

var key = gridLookup.GetGridView().GetRowKey(gridLookup.GetGridView().
GetFocusedRowIndex());
(where gridLookup is ASPxGridLookup ‘s id).
 2.  Call this function on ASPxGridLookup’s client click events.thats it… :):)

Author

Learning days (Calendar)

May 2011
M T W T F S S
« Mar   Jul »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 498,681 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: