Geeks With Blogs
AzamSharp Some day I will know everything. I hope that day never comes. February 2006 Entries
Creating a Message Helper Class
I am working on a project in which I have to display lots of messages to the users. Most of these messages are help text so users will know how to navigate and how to use the website. The common approach of displaying the messages is simply assigning the label control some text. Here is the common approach. if (result) { lblStudentWelcomeMsg.Text = "Welcome to the website"; }As, you can see that the above code and technique will cause a maintanence nightware. What I proposed and implemented is saving ......

Posted On Tuesday, February 28, 2006 3:37 PM

Maintaining CheckBox Values While Paging in the GridView Control
Have you noticed that if paging is enabled on the GridView control and you have many checkboxes and you check few of the checkboxes that are contained in different pages then the next time you go to that page (I am talking about GridView pages i.e paging) all the checked values are gone. I wrote an article for www.aspalliance.com which demonstrate that how you can maintain the CheckBox values while paging. Check out the article: http://aspalliance.com/774 Hope you like it! powered by IMHO 1.3 ......

Posted On Monday, February 27, 2006 10:02 AM

Custom Attributes
Okay I was kinda getting bored so I thought of writing a simple Custom Attribute. This custom attribute simply prints out the attribute information that the user defines on the method. The information contains the method author, description and the date created. Here is the Custom Attribute Class: using System;using System.Collections.Generic;... System.Text;namespace TestingConsoleApplication{ [AttributeUsage(AttributeTa... true)] class CodeHistory : System.Attribute { ......

Posted On Thursday, February 23, 2006 9:36 PM

Skins does not support MaxLength Property of the TextBox
I was just trying to set the MaxLength property of the TextBox in the SKIN file when it throwed the exception that MaxLength property cannot be set in the SKIN file. I wonder if I can find the list of properties which cannot be set in the Skin FILE. powered by IMHO 1.3 ......

Posted On Thursday, February 23, 2006 2:02 PM

CreateUserWizard Control will file CreateUser internally!!
So, I decided to create my own custom membership provider. I only implemented the CreateUser method since that was the main thing I was looking for. Here is the code for the CreateUser method in my custom membership provider: public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { bool result = false; MembershipUser user = new MembershipUser(Name, ......

Posted On Thursday, February 23, 2006 10:34 AM

Wizard Control (Set the step to 0)
If you have used the Wizard control you will be familiar with the SideBar where you can see the links to all the steps in your wizard control. If you are doing some changes to let's say step 3 and leave it like that without clicking on the step 0 then it means that next time you load your wizard control it will start from step 3 and not step 0. Hence, you should always set your wizard step to 0 so that it can start from the beginning. powered by IMHO 1.3 ......

Posted On Wednesday, February 22, 2006 11:06 PM

Redirecting users depending on role
I am sure that you have faced a scenario where you need to redirect a user based on his role. There can be many methods of redirection here I am mentioning one of them. What I did is put the name of the role and the redirection url in the web.config file. Some thing like this: <add key="Admin" value="Admin/AdminHomePage.... <add key="Teacher" value="Teachers/TeacherHome... <add key="Student" value="Students/StudentHome... <add key="ErrorPage" value="ErrorPage.aspx"/> ......

Posted On Wednesday, February 22, 2006 5:47 PM

Login Controls are Awesome!!
I was just using the LoginName and LoginStatus control and I have to admit that both are pretty awesome controls. Just place them on your page and they will display messages depending on whether you are logged on or not. The best thing is that you don't have to write any code to make them work. Simply drag and drop on the webform and they will work with the login control. powered by IMHO 1.3 ......

Posted On Monday, February 20, 2006 3:01 PM

Visual Studio.NET 2005 does not let me rename my Web Server Control
As usual I found another BUG in Visual Studio.NET 2005. I am sure most of you have already encountered this issue. I am trying to do something very simply. All I am doing is renaming my Label control. When I try to rename is it pops the message box saying "If you have references in markup they will not be renamed. Do you want to continue". It does not matter whether you press "YES" or "NO" because both of them will do NOTHING. I hope these annoying bugs are fixed ASAP! powered by IMHO 1.3 ......

Posted On Monday, February 20, 2006 9:43 AM

Leaning the new technology!
Learning the new technology is always little hard. Check out my small non-technical article in which I explained how I learn the new technology. Please also make your suggestions. http://gridviewguy.com/Arti... powered by IMHO 1.3 ......

Posted On Saturday, February 18, 2006 12:02 AM

Connection String problems for Access Database
Has it ever happen that you have made the Access database connection and it worked on your local machine and blows on the development server? I am using the connection string in two parts take a look at the code below: <appSettings> <add key="ConnectionString" value="Provider=Microsoft.J... User Id=admin;Password=;Data Source=" /> <add key="ConnectionPath" value="/Database/MyDatabase... /> </appSettings> And here is the C# code that combines and build up the connection ......

Posted On Friday, February 17, 2006 11:19 PM

Getting the value out of the control contained in CreateUserWizard Control
I was using CreateUserWizard to create a user. I changed the control so that it contained custom TextBoxes. Now I wanted to get the value out of the TextBoxes. The first approach I tried was the following (offcourse it did not worked!). TextBox firstNameTextBox = (TextBox) CreateUserWizard1.FindContr... This will always return null why? Well it returns null since the TextBox is not contained inside the CreateUserWizard control but its inside a template contained by the CreateUserWizard ......

Posted On Friday, February 17, 2006 7:54 PM

Display something when there is GridView is empty
GridView control has the EmptyDataTemplate which can be used to display any controls in case where GridView does not render anything. Since Header and Footer are not displayed when GridView does not contain anything thats why EmptyDataTemplate is a perfect place to display input controls so user can input data and populate the GridView control. powered by IMHO 1.3 ......

Posted On Thursday, February 16, 2006 8:16 PM

Returning ArrayList from a WebService
These days I am working on a Project in which I need to implement a Service Oriented Architecture. The services are exposed as Web Services. I was planning to return the List<User> to the client but found out that List cannot be returned since its not serializable. I plan to use ArrayList and that worked. If you would like to return an ArrayList from the WebService you can do so check out the simple code below: [WebMethod] [System.Xml.Serialization.X... public ArrayList ......

Posted On Wednesday, February 15, 2006 7:00 PM

Injecting the Script
In my previous post I talked about that by using AJAX.NEt Library I am not able to access the JavaScript methods which were to be called from the Page. One solution is to Inject the JavaScript into the page which is using AJAX. Take a look at the code below: This is the code for the BasePage: public class BasePage : System.Web.UI.Page { private const string SCRIPT = "ScriptString"; [Ajax.AjaxMethod] public string GreetUser() { return "Hello World"; } public void InjectScript() { string scriptString ......

Posted On Wednesday, February 15, 2006 2:16 PM

Wierd problem when putting javascript functions for AJAX.NET Library in a .js file
I was trying to gather all my JavsScript functions and put them in a single .js file so that everything will be inorder and in one place. Below you can see that there are 2-3 functions in my .js file. function Foo() { alert('Foo has been called.');}function GreetUser() { WebForm1.GreetUser(GreetUse... }function GreetUser_CallBack(response) { alert(response.value);} Now after defining the functions I register my page to use the AJAX.NET Library. public class WebForm1 : System.Web.UI.Page ......

Posted On Wednesday, February 15, 2006 1:23 PM

GridViewGuy will be back tomorrow :)
You all must be wondering where is GridViewGuy gone! Well I had my birthday on 9th Feb and my wife came from California to visit me. She came to Houston, TX for the first time so I was showing her Houston attractions. I will be back in GEEKY PROGRAMMING PHASE tomorrow. powered by IMHO 1.3 ......

Posted On Monday, February 13, 2006 10:43 AM

Happy Birthday to me :)
Turned 25 today happy birthday to me :)

Posted On Thursday, February 9, 2006 5:15 AM

My Posts feature has been added to the GridViewGuy forums
Yesterday, I added a simply feature of my posts to the GridViewGuy forums. This feature will allow you to view your posts and keep track that if anyone has answered or not. Check out the GridViewGuy forums at www.forums.gridviewguy.com. powered by IMHO 1.3 ......

Posted On Thursday, February 2, 2006 9:43 AM

Copyright © Mohammad Azam | Powered by: GeeksWithBlogs.net