Posts

Showing posts from July, 2013

Add Blocked File Types in SharePoint 2010

string webAppUrl = "Your URL" ;                 string myBlockFileType = "dll" ;                     Uri myUri = new Uri (webAppUrl);                     SPWebApplication myWebApp = SPWebApplication .Lookup(myUri);                     Collection< string > blockFileTypes = myWebApp.BlockedFileExtensions;                     blockFileTypes.Add(myBlockFileType);                     myWebApp.Update(); Hope this will helps you... Happy Coding....

Displaying the FileUpload Control image in Image Control Inside the GridView

scenario :   Display the image in the asp Image control while uploading by using Javascript...   Here you go with the solution..... function GetImage(field, rowIdx, col) {                           var cellValue = 0;             var currValue = 0;               rowIdx = parseInt(rowIdx) + 1;             var objGridView = document.getElementById( ' <% =newGrid.ClientID %> ' );             cellValue = objGridView.rows[rowIdx].cells[3].children[0];              cellValue1 = objGridView.rows[rowIdx].cells[3].children[1].value;             var ext = cellValue1.substring(cellValue1.lastIndexOf( '.' ) + 1);             if (ext == "gif" || ext == "GIF" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "JPG" || ext == "png" || ext == "PNG" ) {                 objGridView.rows[rowIdx].cells[3].children[0].src = cellValue1;       

Getting values from SharePoint calculated column

Here you go for getting values from the Calculated column. SPFieldCalculated  month = ( SPFieldCalculated )oitem.Fields[ "Month" ]; SPFieldCalculated  year = ( SPFieldCalculated )oitem.Fields[ "Year" ]; lblOrderConformation.Text =  "ORDER CONFIRMATION IN - "  + month.GetFieldValueAsText(oitem[ "Month" ]) +  " "  + year.GetFieldValueAsText(oitem[ "Year" ]); Hope this will help you ....

How to Restore SQL Server 2008 R2 Suspect Database

EXEC   sp_resetstatus   'YourDatabaseName' ; ALTER   DATABASE  YourDatabaseName  SET   EMERGENCY DBCC  checkdb ( 'YourDatabaseName' ) ALTER   DATABASE  YourDatabaseName  SET   SINGLE_USER   WITH   ROLLBACK   IMMEDIATE DBCC  CheckDB   ( 'YourDatabaseName' ,  REPAIR_ALLOW_DATA_LOSS ) ALTER   DATABASE  YourDatabaseName  SET   MULTI_USER Hope this will helps you !!!

Disable Key press on SharePoint:DateTimeControl

Sharepoint DateTime control is placed in a Webpart or Application Page. We need to allow the users to select the Date from the Date Picker ICON in the DateTime Control to avoid the typing in the DateTime Control TextBox. Here you go for the solution : In Code behind : (( TextBox )(dtpClearfrmCustoms.Controls[0])).Attributes.Add( "readonly" , "readOnly" ); In Source Page : < SharePoint : DateTimeControl ID ="dtpClearfrmCustoms" runat ="server" DateOnly ="true"                         LocaleId ="2057" /> JavaScript validation for SharePoint DateTime Control if (document.getElementById( ' <% = dtpClearfrmCustoms.Controls[0].ClientID  %> ' ).value == "" ) {   alert( "Please select the date" );                 return false ;     } Hope this would helps you....