Friday, April 24, 2015

Starting the SharePoint Central Admin giving runtime Error


When Starting the Share point Central Administration I get Run-time Error.

Follow the steps below

1) Go to IIS
2) Expand the "Sites" folder and select "SharePoint Central Administration v4 " virtual directory
3) In the "Actions" section click Explore
4) The site physical folder will open and contains web.config file.
5) Open web.config file find the "CustomErrors" tag.
6) Set its mode attribute to mode="Remoteonly"
7) Refresh and Re-open the central Administration Site in browser
8) You will Get the following error now

Error: This operation can be performed only on a computer that is joined to a server farm by users who have permissions in SQL Server to read from the configuration database. To connect this server to the server farm, use the SharePoint Products Configuration Wizard, located on the Start menu in Microsoft SharePoint 2010 Products.

Cause: SQL Server for SharePoint services stopped due to restart of my machine

9)  Now Open the Services.msc
10) Restart the "SQL Server(SHAREPOINT)" service
11) Also Enable and Restart the "SQL Server Agent (SHAREPOINT)"
12) Also Enable and Restart "SQL Server Browser" 

PS: I hope this helps. Please drop your comments.

Tuesday, April 14, 2015

how to use requiredfield validator with dropdownlist


Here is how we can use requiredfieldvalidator with dropdownlist.

Set the below property of the dropdownlist control

AppendDataBoundItems = true

Then Insert a default value in the Page_Load event

ddl.Items.Insert(0, new ListItem("<<-Select-->", "-1"));

Now define the required field validator and set its initialvalue attribute to "-1"

<asp:RequiredFieldValidator ID="reqddl" runat="server" Text="*" ControlToValidate="ddlRole" InitialValue="-1" SetFocusOnError="true" Display="Dynamic" ValidationGroup="Add"></asp:RequiredFieldValidator>

Happy coding :)