Monday, March 16, 2020

newtonsoft.json 11.0.2' package requires nuget client version '2.12' or above

Solution: 
Update your NuGet Package Manager extension. Go toTools->Extensions and Updates and selectUpdates->Visual Studio Gallery. Update the NuGet Package Manager extension. Then try to install the package after Visual Studio gets restarted.

Tuesday, March 10, 2020

Verbatim string c#

string path = @"AppData\Example1"; 

C# supports two forms of string literals: regular string literals and verbatim string literals. A verbatim string literal consists of an @ character followed by a double-quote character, zero or more characters, and a closing double-quote character. A simple example is @"asp net MVC".

Friday, March 6, 2020

using itextsharp form fill issue with checkbox in C#

First of all open pdf escape website. upload your pdf to pdf escape and click upload.
After upload selects the particular checkbox and right-clicks and unlocks form field.
Again click the checkbox and right-click you will get the "object properties".
Click "object properties".
Next, You will get pop like "form field properties".
Here you will get "Export Value" - for example, Yes or 1 or 0

In your code use, this "export value" you will get output. 

Thursday, March 5, 2020

datatable filter rows or where condition in datatable in c#

DataRow[] dr = dtDepaet.Select("Id= " + deptId); // where clase in datatable. here id is a column name 
string name = dr[0]["Name"].ToString(); 

Sunday, March 1, 2020

How to clear previous search history in the immediate window

 type >cls in immediate window and Enter.

Friday, February 28, 2020

based on number get alphabets in c#


public string GetAlphabets(int number)
{
   string strAlpha = "";
   try
   {
     strAlpha = ((char)number).ToString();
   }
   catch (Exception e)
   {
     string message = e.Message;
     throw;
   }
   return strAlpha;
}


Wednesday, February 26, 2020

An item with the same key has already been added

"exceptionType": "System.ArgumentException",
  "message": "An item with the same key has already been added.",  "exceptionType": "System.ArgumentException",
  "message": "An item with the same key has already been added.",

Solution: In your model or .cs file same keys
Ex: public class Student
{
 public int Sid {set; get;};
 public string Name {get; set;}
 public sting Sid {set; get;} //Same Name - here we will get above exception. if we chnage to another name this issue will resolve.

}

Saturday, February 22, 2020

stop confirm resubmission in page refresh time

<script>
if ( window.history.replaceState ) {
  window.history.replaceState( null, null, window.location.href );
}
</script>

Create hidden or private folder in windows

open notepad and paste below code and save .bat extension. password place changes your password. 

open your saved file. Here automatically create one folder like private. 
if you want to hide that folder open you're saved file it will open one command prompt type here "Y".
again if you want to open the private folder open you're saved file it will open one command prompt type here your password.



Quote: cls

@ECHO OFF
title Folder Private
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDENTER PASSWORD TO OPEN
:CONFIRM
echo -----------------------------------------------------------
echo ================== Choulla Naresh ==================
echo -----------------------------------------------------------
echo Are you sure you want to lock the folder(Y/N)
echo Press (Y) for Yes and Press (N) for No.
echo -----------------------------------------------------------
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo -----------------------------------------------------------
echo ================== Choulla Naresh ==================
echo -----------------------------------------------------------
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== YOUR PASSWORD goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDENTER PASSWORD TO OPEN
md Private
echo Private created successfully
goto End
:End

Thursday, February 13, 2020

how to add project to GitHub repository

Open GitHub and create a repository
Next, execute a command in Gitbash
next, take update using GitHub repository URL
paste ur project and commit

Example : URL: https://github.com/C-Naresh/aspdotnet.git

Execute this command in GitBash

echo "# aspdotnet" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/C-Naresh/aspdotnet.git
git push -u origin master

Now take update using this url https://github.com/C-Naresh/aspdotnet.git

Add your existing project inside folder and commit that's it...