Thursday, July 15, 2010

Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'RewriteModule' - HTTP Error 500.19 - Internal Server Err

When I uploaded the site to the server, I got an HTTP Error 500.19 - Internal Server Error which says "Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'RewriteModule'". Error was in the following line in web.configI got the solution to change the application config file from the following link:http://support.microsoft.com/kb/942055But, hosting providers...

Friday, July 9, 2010

Issue when using AsyncFileUpload control

4:14 AM Posted by Unknown , , No comments
I tried to use AsyncFileUpload control in a page. The AsyncFileUpload control was placed inside the first view of a multiview control. The page required a querystring parameter, and if the parameter is not present, the second view of the multiviewcontrol will be shown. This check is made on the Page Load event. This causes issue on the fileupload process. It was giving error, since on the postback,...

Wednesday, July 7, 2010

Germans also are gone :-(

My two favorite teams are out from WorldCup 2010, Germany and Argentina. :-( Spain really deserve that victory over Germany.I know, it is bit late. But, I just came to a contribution from Microsoft for World Cup. So, I thought, I should share with you.Track world cup scores with exc...

Tuesday, July 6, 2010

Generate sql script with data from database

11:39 PM Posted by Unknown No comments
How can we copy data as well the structure and schema as sql query? We need database publishing wizard for that.Download the database publishing wizard.It will be installed at following location : C:\Program Files\Microsoft SQL Server\90\Tools\Publishing\run the exe and you can get the sql file with all the data, schema and structure of the database you sele...

Thursday, July 1, 2010

Wednesday, May 19, 2010

System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay

10:52 PM Posted by Unknown , No comments
I have got this issue many times, when I try to send email using smtp. There can be several causes for this. You have to allow relay for mail to be sent to outside servers like gmail.com. For sending mail within your server you don't have to do this. You can find some helps from the following links:Help1Help2Help3The code I have used is given below:using System.Net.Mail; SmtpClient smtpClient...

Friday, April 23, 2010

Wednesday, March 31, 2010

Grouping Gridview

7:31 PM Posted by Unknown No comments
Some times we want to group gridview. ZNet is a good control for this use.ZNetWe can use this for grouping and also for the comparis...

Saturday, March 13, 2010

specifying ValidationGroup in Page_ClientValidate function

1:41 AM Posted by Unknown , No comments
Hi,We know that, Page_ClientValidate function tests if all controls meet asp.net validation criteria. This function is provided by asp.net. But, if we use more than, one validation group in the page, we may have to specify the validation group, we want to validate. For that, give like given below:Page_ClientValidate('ValGroupName')Then, it will validate only for that validation gr...

Friday, March 5, 2010

The Controls collection cannot be modified because the control contains code blocks

10:26 AM Posted by Unknown No comments
This is a common error. It occurs when we use <%= %> tag inside the head tag with runat="server" given. You can get rid of the error by removing the runat="server" from the head tag. But, sometimes, we want to keep that. We can use <%# %> instead of <%= %>. But, then, the value may not get bound and we may not get the value of the expression. So, when we use <%# %>, we have...

Wednesday, March 3, 2010

To access control of a User Control from an aspx page

9:44 AM Posted by Unknown No comments
Whenever you want to access the controls of an usercontrol, create public properties for those controls in your usercontrols and you could easily access them in your .aspx page.Here it goes how...UserControl. 1 public partial class WebUserControl : System.Web.UI.UserControl2 {3 public string TextBoxValue {4 get { return TextBox1.Text; }5 set { TextBox1.Text = value; }6 ...

Friday, February 26, 2010

Converting DateTime to ShortDate in SQL

4:04 AM Posted by Unknown , No comments
When you need to get datetime field value in short date, use the following:To get today's date in YYYYMMDD format: SELECT CONVERT(CHAR(8), GETDATE(), 112)To get today's date in mm/dd/yyyy:CONVERT(VARCHAR(10), GETDATE(), 101)Helpful L...

Monday, February 15, 2010

Showing JavaScript confirmation after Client Validation

8:07 AM Posted by Unknown , No comments
Some time we use javascript to display alert or confirmation box on button click. But, if we are using ajax validation on that page, that will work only after post back if we click ok on the confirmation box. So, to display the confirmation box, only if the page is valid, Check this l...

Thursday, February 4, 2010

Wednesday, February 3, 2010

Calling method of a usercontrol from another usercontrol

10:21 AM Posted by Unknown 1 comment
I need to call the method in a usercontrol from another usercontrol. Both controls are placed in same page. If it is a web application, both controls will be in same namespace. So, we can get their names in the codebehind. for eg. if control1 is to be found from control2. both control1 and control2 are in folder controls. webapplication name is test. So the namespace would be test.control2. Since,...

Finding Controls

10:17 AM Posted by Unknown No comments
Check the name of the control in the rendered html. For eg. I need to find gridview "grdwSelectedCandidates" in usercontrol "SelectedCandidates.ascx" which is inside the ajax tabpanel inside ajax tabcontainer.I need to find this from another control which is placed in another tabpanel in the same container. The rendered name is "ctl00_ContentPlaceHolder1_TabContainer1_TabPanel6_SelectedCandidates1_grdwSelectedCandidates"So,...

Wednesday, January 27, 2010

For using excel file as database

6:11 AM Posted by Unknown , No comments
For reading Excel files and getting the datastring FilePath = Server.MapPath("exmaple.xls"); DataSet myDataset = new DataSet(); string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FilePath + @";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""; OleDbConnection conn = new OleDbConnection(strConn); conn.Open(); DataTable...

Tuesday, January 26, 2010

Firebug Extensions

9:45 PM Posted by Unknown , No comments
Firebug is the most usefult addon tool for web development. It can help us to find the issues in css, ajax requests etc and many features. There are some other addons which can help to improve the utility of firebug. Learn M...

Monday, January 25, 2010

7:46 AM Posted by Unknown No comments
...

Saturday, January 23, 2010

Ajax and UpdatePanel performance improvement

7:38 PM Posted by Unknown , , , , No comments
Most of the newbie programmers like me are ajaxifying a site by putting updatepanels all over the site. Now, I came to know that, putting updatepanel will not help you to improve your site's speed. We are using it, since it is very easy. You can understand why ajax updatenpanels should be avoided from the following linkWhy UpdatePanel Dangerous If you still want to use updatepanel, check the...

Top Money giving Paid To Click site

9:49 AM Posted by Unknown No comments
Its an off topic. I just came to know about this site. They are giving the maximum for click. 50 cents for just clicking banners and 1 USD for reading their emails. Also, referral bonus is there. payingptr....

Friday, January 22, 2010

Know the control which caused the postback

8:28 PM Posted by Unknown , No comments
I got this from some site. It can be used to know the control which caused the postback.  public static Control GetPostBackControl(Page thePage)     {         Control myControl = null;         string ctrlName = thePage.Request.Params.Get("__EVENTTARGET");         if (((ctrlName...

Limit in Argument size for functions

8:27 PM Posted by Unknown , No comments
I was trying to insert data to a sql table from code behind.  But, when I tried to see the values using break point, I was not able to see the values. The following link shows the cause and reason. Help L...

Display updateprogress in the clicked position

8:22 PM Posted by Unknown , No comments
On the following example, progress bar(UpdateProgress1) is displayed on the position of the button which got clicked function pageLoad()      {                 var manager = Sys.WebForms.PageRequestManager.getInstance();               ...

JQuery default functions

8:21 PM Posted by Unknown No comments
Following is the jquery default function that is run. we can use this to get the ajaxrequests function pageLoad() {             if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {                 Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(AjaxBegin);      ...

8:16 PM Posted by Unknown No comments
Use ScriptManager.RegisterStartupScript, when using ajax updatepanel to add javascript from codebehind.for eg. just showing a message box, on of a button in updatepanel ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "scriptname", "var position=$('#" + Btn.ClientID + "').offset();$('#').html('Button clicked').css(position).fadeIn(2000).fadeOut(2000);", true);can get position using...

First Post

8:14 PM Posted by Unknown No comments
My First Post. Hope this blog will help me and others too.I am going to post all the new things I am learning everyday regarding programming. Hope it helps somebo...