Update Panel with Required Field Validator Not Working

Recently i faced some strange problem with required field validator, inside a update panel its not working, since some controls are dynamically loaded with required field validattion.

But its not working properly (few buttons which has causes validation set to false also not triggering properly), then i found a solution that for any required field validation (or any validation controls), it has to load during the page load itself , so i have created a dummy text box and dummy required field validator to make sure that the validation controls emits the javascripts properly to browser.

<div style=”display:none”>

<asp:TextBox id=”txtDummy” runat=”server” Visible=”false”/>

<asp:RequiredFieldValidator ID=”reqDummy1″ runat=”server” ControlToValidate=”txtDummy” Text=”*” ValidationGroup=”DummyValgroup” ErrorMessage=”Please provide text”></asp:RequiredFieldValidator>

</div>

This helps to do the validation for dynamically created controls with validation.

 I hope this may helpful for

Property Bag in SharePoint

In SharePoint we can store a property value like a Hash table (key- value pair) using custom coding.
This property can be used to set and retrieve at various objects of SharePoint like (SPSite, SPWeb)

Following is a small sample piece of code to set the property value

try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
//open the web and set the property
using (SPSite spSite = new SPSite(strWebUrl))
{
using (SPWeb spweb = spSite.OpenWeb())
{
spweb.AllowUnsafeUpdates = true;
bool isPropertyFound = spweb.Properties.ContainsKey(propertyKey);
if (isPropertyFound)
{
spweb.Properties[propertyKey] = propertyValue;
}
else
{
spweb.Properties.Add(propertyKey, propertyValue);
}
spweb.Properties.Update();
spweb.Update();
spweb.AllowUnsafeUpdates = false;
}
}
});
}
catch (Exception ex)
{
throw ex;
}