Insert default value for Messages Per Page ?

Topics: Help
Aug 17, 2008 at 8:06 AM
Edited Aug 17, 2008 at 8:12 AM

Having trouble with the 'My Details' section...

the required field Messages Per Page is a stumbling block for most of the users that want to change details. If they try to add an avatar or modify details, they don't notice the required field 'messages per page'. They tell me the page isn't working since they don't see anything happen when they hit 'Update' (don't see the red asterisk by msgs per pg). For now, I've removed forums from the sitemap because we're not using them just yet.

If I remove the validation, users can update contact details and add an avatar, but if they update profile, they get an error about Error updating profile: Conversion from string "" to type 'Integer' is not valid. if they don't put an integer value in Messages Per Page.

Fair enough, I figured if I could force a default value, say, 10 for Messages Per Page, bob's my uncle. how do i do that...hmmm...I see there is a default value for avatars if null?
IfNot IsDBNull(MemInfo.Avatar) Then avatarimage.ImageUrl = "~\UserControls\AvatarImagefetch.ashx?Memberid=" & user.ProviderUserKey.ToString

So I'm not sure how to do this for Messages Per Page...
If Not IsDBNull(MemProf.MsgsPerPage) Then MsgsPerPageTextBox="10"
don't laugh! I'm trying :) Can someone point me in the right direction?

Aug 21, 2008 at 5:57 PM

I perform a re-direct from the registration (register.aspx) page to the details (details.aspx) page. Since the field is required they shouldn't be able to save changes to details without updating the field. I know this doesn't default it though. Do you have a Required Field Validator for the MsgsPerPage? You should. I believe this was changed in a later changeset. It would create the asterisk and tell the user to supply and input before they can save their page changes.
Aug 23, 2008 at 3:17 AM
In the sub routine UpdateProfileButton_Click it has the line:

Mem.MsgsPerPage = MsgsPerPageTextBox.Text

Change this to something like:



MsgsPerPageTextBox.Text = "" Then  
    Mem.MsgsPerPage = 10 
    Mem.MsgsPerPage = MsgsPerPageTextBox.Text
End If

If you're concerned about your users entering non-numeric characters then you'll need to use OnTextChanged on the MsgsPerPageTextBox control to call a function and validate what they've entered. 

I hope this helps.