0

Sharepoint Dll Replace in GAC without deployment

Hi Friends,

Well, who and all working in Sharepoint webparts or dlls, we have faced issue while development like for each small code behind changes we need to deploy the code (or) publish the code. It will kill our deployment time.

Instead of that we can find the dlls in GAC and can change the particular dll and do the IIS reset.

Quick Steps:

Finding and Replacement of DLL:

  1. Build the application and copy the dll inside bin (if you don’t find the bin then click show all files or open folder in file explorer)
  2. Navigate to GAC … in Run (ctrl+R) please enter the path
  3. a. In SharePoint 2010 path is  “c:\windows\assembly”b. SharePoint 2013 : “c:\windows\microsoft.net\assembly
  4.  “C:\windows\microsoft.net\assembly\GAC_MSIL” –> in this path you can directly find the web as well as libraries
  5. Click on the web or class libraries folder,can see the folder starts like “v4.0_1.0.0.0_” (note: Based on the framework version)
  6. Open the folder and you can find the dll of the web application.
  7. Rename the existing dlls or delete it and paste your dll which you copied from bin

IIS RESET:

  1. open run (ctrl+r)
  2. type “cmd” and hit enter key
  3. type “iisreset” and hit enter

Now you can browse the application and you can change your changes without deploy the code.

0

Compare Validator Disable Submit when validtion failed

Hi Dudes,

Little info about compare validator . We need to set

ContolToValidate=”IdOftheTargetTextBox”

ValidationGroup=”SetSameNameAsLike in SubmitButton”

Operator –> If we set Greater than equal means it will show error message when we enter lesser date

If u need to compare with Current Date means need to set ValueToCompare  property in page_load. Like a mentioned follow….

Aspx Side :

<asp:TextBox ID=”txtDueDate” Cs  ReadOnly=”true” runat=”server” />

<asp:CompareValidator ID=”cmpVal1″ ControlToValidate=”txtDueDate” Display=”Dynamic”  ValidationGroup=”SaveGroup” Type=”Date” Operator=”GreaterThanEqual”   SetFocusOnError=”true” BorderColor=”Red”  ErrorMessage=”Cannot be lesser than today”
ToolTip=”Date cannot be lesser than today” runat=”server”></asp:CompareValidator>

<asp:Button ID=”btnSave”   ValidationGroup=”SaveGroup” runat=”server”      Text=”Save” CssClass=”button” OnClientClick=”return validateAnalysisElements()”                                                        OnClick=”btnSave_Click” />

Script :

<script type=”text/javascript”>
function validateAnalysisElements() {
            if (Page_IsValid) {
                return true;
            }
            else {
                return false;
            }
}
</script>

Page.CS

In Page_Load  We need to set Current date to the compare validator . Then it can validate while compare

cmpVal1.ValueToCompare = DateTime.Now.ToShortDateString();

 

0

Disable Back Button of Browser

Put Following script in Masterpage. Through that u can prevent it for the whole website

<script type=”text/javascript”>
      window.location.hash = “no-back-button”;
        window.location.hash = “Again-No-back-button”; //again because google chrome don’t insert first hash into history
        window.onhashchange = function () { window.location.hash = “No-Back “; }
</script>

When you put like that In Browser Url window U can see

http://localhost:62951/Home.aspx#No-Back

0

Questions in C#

1. What is the states available in asp.net?

Client side state:

  • View State
  • Control State
  • Hidden fields
  • Cookies
  • Query Strings

Server side state :

  • Application State
  • Session State

2. What is static class ?

A static class should contain static members and fields . Static fields values wont change for the whole Application.

  • Static methods should be specific to the application, not for the specific user. We cant replace it for session.
  • Static methods object state doesn’t change.  so generally they will use static methods for retrieval operation. We wont use Insert, Update methods with static cos its state will change
0

Sql Query to Select

SELECT * FROM TableName

Take Particular Column :

 SELECT ColumnName From TableName

Take Particular Row From Table:

 SELECT * FROM TableName WHERE ColumName ='xyz'

 (Note: If the column is Interger u can directly pass the value if it is string means u can use single quotes )

Take Particular row and Column :

SELECT ColumnName FROM TableName WHERE ColumnName=x -- Note When x is integer

Dynamic Sql —

After u learn normal sql, Please go to practice for Dynamic sql. That will help to improve ur logics