Archive for the 'ASP and ASP.net' Category

How easily to create a required validator requiredfieldvalidator for CheckBox control in asp.net 2.0

Challenge:

 I tried to add a CheckBox control to the registration page in my newly implemented open source YetAnotherForum asp.net application. And this CheckBox is for Terms and Conditions agreement, so it needs to be checked before the users submit registration form. It looked like the easy way was to use a RequiredFieldValidator to validate the CheckBox control. But unfortunately this RequiredFieldValidator validation Web control does not work with the CheckBox (or CheckBoxList) Web controls. After I set its ControlToValidate property to the ID of the CheckBox, the page threw an HttpException, saying:

"Control ‘controlID’ referenced by the ControlToValidate property of ‘validationControlID’ cannot be validated." 

Ok, I can perform the validation check in the postback code or replace the RequiredFieldValidator with CustomValidator control. But this is for a constantly updated open source application, I did not want to change too much source code in case I will get overwritten in the next release. So, I need a quick and dirty way to do this.

Continue reading ‘How easily to create a required validator requiredfieldvalidator for CheckBox control in asp.net 2.0′

Related posts

Fix a bug in YetAnotherForum version 1.9.1.8

YetAnotherForumAs my previous post said, I installed Yet Another Forum v1.9.1.8 on my server, then I created a board/forum. In my first and only one forum, I turned on the moderate mode which means that any post topic will not show till the forum administrator approves.

Then I went ahead to create the first new topic, and later on a few replied have been posted. Everything was fine but a few days ago the front page could not be seen. I tried a couple of times, only saw the error messages (There has been a serious error loading the forum. No futher information is available…) as the following screen shot. And funny thing was I still could access to other web pages include the administrative portion.

Error Message

Continue reading ‘Fix a bug in YetAnotherForum version 1.9.1.8′

Related posts

Can not start a workflow from a survey response in Windows SharePoint Services 3.0 (MOSS 2007) with "Failed to Start" error

Challenge:

sharepoint When I was approached by a co-worker to come up a quick solution to design a training registration application. The requirement is to display all upcoming training events in calendar view and allow users to register to each training. And upon the registration is submitted, the training department and the user’s supervisor should receive notifications immediately (although not required now, but might need the approval from the supervisor in later development). The deadline is very…, how to say it, … how about this afternoon. Well, while the co-worker asked how to design the database tables and asp.net coding, I suggested why not giving the SharePoint a shot. Since I am the one proposed, then I had to create it for her.

Well, that was what I came up so far. In our Microsoft Office SharePoint Server System (MOSS) 2007 with Windows SharePoint Services 3.0 (WSS), I created a calendar list to display training events; in the calendar item there was a link to another new created survey list acting as a registration form. Then I added a workflow to the survey so that emails will be sent out whenever a new response is added into the survey (or register list).

Everything is working fine, but however, the workflow does not start. Instead, the status of the workflow appears as Failed to Start.

Trouble-Shootings:

I searched this issue on Google, and I found out a lot of people had the similar errors before. Someone pointed out the cause was the user of application pool who should be Network Services instead of a user with administrative right; Someone suggested to re-active the workflow feature in SharePoint Application server; Someone asked whether it was done in SharePoint Designer  2007.

Continue reading ‘Can not start a workflow from a survey response in Windows SharePoint Services 3.0 (MOSS 2007) with "Failed to Start" error’

Related posts

About the installation of YetAnotherForum

YetAnotherForumSome steps to install the free ASP.NET open source forum:

1. First of all, of course you should download this application from http://www.yetanotherforum.net/.
2. Prepare the Microsoft SQL Express database. If you have not installed any on your servers yet, you can download it from Microsoft website for free. When you are on Microsoft Download center, remember you not only need  SQL Server 2005  Express database service, but you also need SQL Server Management Studio Express to create a initial forum admin user.
3. Create a login for your new SQL database, and then a new database Instance. With such information, including Database Name and Logon Account/Password, you can modify the yanet.config first before you start to install the forum.
4. Finally, you can run the installation from the URL of http://yourdomainname/YaNet/install/default.aspx.

Continue reading ‘About the installation of YetAnotherForum’

Related posts

Recommend a free ASP.NET C# open source forum

YetAnotherForumCurrently it is very difficult to find a good ASP.NET discussion board program. Since one of my clients is using Windows hosting plan, it is not good to recommend vBulletin or PHPbb to him when he asked my suggestion on setting up a community forum.

To started, I did a little bit of researches on the following 3 asp.net forums.

  1. Jitbit 的 ASPNetForum 4.5.x (free, $85 and $169 versions)
  2. Austrian Active Data Online - Discussion Board 6.x ($200)
  3. England Instant Forum 4.x ($119 or $199)

Only AspNETForum offers the downloads, for the others you will have to go to their web sites for the demonstrations. To be summarized, all of the three above are not too bad, and not too expensive. Especially the AspNetForum can be free if you keep its logo on your forum. And AspNetForum is very clean and simple on the layout too. But “simple” is not always good for the administrators. In AspNetForum, you can not set up different type of boards, and you could not control the configuration from the back-end control panel either. For example, you will have to edit the web.config file to set up bad words filter.

Continue reading ‘Recommend a free ASP.NET C# open source forum’

Related posts

How to conditionally display image in Gridview based on data fields in ASP.NET 2.0

ASP.netChallenge: How to display an image in a column of ASP.NET Gridview based on the data from a database table. For example, I have a GridView to display some speakers’ profile with name, address etc. Within it, I need to display a clip icon in the column of “Speech” to indicate that this speaker has a speech document attached. Continue reading ‘How to conditionally display image in Gridview based on data fields in ASP.NET 2.0′

Related posts

How to fix issues of sending email in ASP.net 2.0 with localhost Microsoft SMTP service

With the upgrading to ASP.net 2.0, I decided to change all my sending email codes too. Basically I am going to use system.net.mail instead of system.web.mail or traditional CDONT. I thought it would be an easy task, but I still encountered some issues.

Continue reading ‘How to fix issues of sending email in ASP.net 2.0 with localhost Microsoft SMTP service’

Related posts

How to display and edit multiline in datagrid controls with Databinding

ASP.NETI have a gridview web control in one asp.net 2.0 page which has a field with mutliline texts need to be displayed and updated. I am using SQLDatasource to retrieve the data from my database and then use databinding to this gridview. When the mutliline texts showed on the gridview, all line breaks were gone. For example, the original texts came from the user in the database were: Continue reading ‘How to display and edit multiline in datagrid controls with Databinding’

Related posts

How to Append Master Page title to Content Page title in ASP.NET 2.0

Usually asp.net render the content page title first, but you can append the page title in Page_Load event.

(To Be Continued)

Related posts

Errors occurred when I was upgrading to VS 2005/ASP.NET 2.0

Today finally I got the Visual Studio 2005 installed on my new computer, and tried to move all visual video project from my previous VS 2003 to it. After I open the previous project in VS 2005 and converted and then re-built, then I tried to open the application in the browser. But I got the following error message:

Failed to access IIS metabase.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.

Continue reading ‘Errors occurred when I was upgrading to VS 2005/ASP.NET 2.0′

Related posts