Thursday, September 17, 2020

How to change port for a asp.net web site project?

 1. Go to web site property page,

2. Now Click on Start Options.

3. Now look at server block , and select option Use custom server

And Give an local host url in base url field.

For Ex: http://localhost:2859/WebSite1/

Friday, December 6, 2019

crystal report now showing correct or pure white image

If you want images in your report to keep their original color depth when they are encapsulated, select this option. Otherwise, all images are converted to 8 bits per pixel before being encapsulated.


To check this option go to:
File -> Report Options -> Retain Original Image Color Depth



Friday, April 17, 2015

Linq Convert DateTime? to DateTime in ("dd/MM/yyyy")

Sql Query:
SELECT convert(varchar,[addedat],103) as addedat FROM tblTable


Linq Query:

 var query = from q in entity.tblTable
                    select new
                    {
                     
                        date = SqlFunctions.DateName("day", q.addedat).Trim() + "/" +
                            SqlFunctions.StringConvert((double)q.addedat.Value.Month).TrimStart() + "/" +
                            SqlFunctions.DateName("year", q.addedat),
                    };

Tuesday, November 11, 2014

Install-Package : The current environment doesn't have a solution open.

This error occur , if you not save your solution .sln file. use file-?>saveall.


Tuesday, September 23, 2014

Method error 500. for binding combobox ,dropdown from webservice

Add following code in web.config configuration section.



   
     
       
     

   

 

Thursday, July 18, 2013

System.ArgumentException: The version of SQL Server in use does not support datatype 'datetime2'.

It turns out that Entity Framework 4 somehow got the idea to use SQL Server 2008. The fix was to edit the .edmx file in an XML editor and set the ProviderManifestToken="2005" instead of 2008. (You need to rebuild.)

Wednesday, July 10, 2013

asp.net checkbox modalpopupextender checkbox doesn't check or uncheck

Answer Link:  http://forums.asp.net/p/1072619/1568169.aspx
http://wyerarch.blogspot.in/2010/04/aspnet-checkbox-modalpopupextender.html

Wednesday, May 22, 2013

For the EntityDataSource, if the query specifies a projection and paging is enabled, a sort expression must be defined. Either set the OrderBy property or set AutoGenerateOrderByClause to true.

Use Order BY Clause

1:   <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=Entities"  
2:      DefaultContainerName="Entities" EnableFlattening="False" EntitySetName="tblContacts"  
3:      EntityTypeFilter="tblContact" Select="it.[ContactCode], it.[FirstName], it.[LastName], it.[AddedAt] "  
4:      OrderBy="it.[AddedAt]">  
5:    </asp:EntityDataSource>  

Tuesday, August 23, 2011

Find.Execute() in MS Word 2007 gives a "The stub received bad data" error

Here is the solution
void FindAndReplace(ref Microsoft.Office.Interop.Word.Application WordApp, object FindText, object ReplaceText)
    {
      object MatchCase = true;
      object MatchWholeWord = true;
      object MatchWildCards = false;
      object MatchSoundsLike = false;
      object nMatchAllWordForms = false;
      object Forward = true;
      object Format = false;
      object MatchKashilda = false;
      object MatchDiacritics = false;
      object MatchAlefHamza = false;
      object MatchControl = false;
      object ReadOnly = false;
      object Visible = true;
      object Replace = 2;
      object Wrap = 1;

      

      object[] Parameters = new object[] { FindText, MatchCase, MatchWholeWord, MatchWildCards
                        , MatchSoundsLike, nMatchAllWordForms, Forward, Wrap
                        , Format, ReplaceText, Replace, MatchKashilda
                        , MatchDiacritics, MatchAlefHamza,MatchControl };
      WordApp.Selection.Find.GetType().InvokeMember("Execute", System.Reflection.BindingFlags.InvokeMethod, null, WordApp.Selection.Find, Parameters);      
    }

Tuesday, August 16, 2011

how to return id after insert ms sql


IDENTITY vs SCOPE_IDENTITY() vs IDENT_CURRENT

 

The insert satement should look something like this.

INSERT INTO TABLE (COLUMN1, COLUMN2, ...)
VALUES     (@COLUMN1,@COLUMN2, ...);
SELECT IDENTITY_COLUMN FROM TABLE WHERE (IDENTITY_COLUMN = SCOPE_IDENTITY())

Then in your code do something like this

int identity = Convert.ToInt32(TableAdapter.InsertMethod(value1, value2, value3));

 

Friday, September 24, 2010

GridView must be placed inside a form tag with runat=server

I was creating an online test and I wanted to email the test results by topic to an email distribution list. I have a panel which has two child controls, a label with an overall % correct and a gridview with percentages by topic.

A few simple lines of code would typically handle this:

string listRecipients = ConfigurationManager.AppSettings["candidateTestEmailList"].ToString();
StringBuilder sb = new StringBuilder(2000);
pnlResults.RenderControl(new HtmlTextWriter(new System.IO.StringWriter(sb)));

//---------------------------------------------------------------------
// Send to the mail handler class
//---------------------------------------------------------------------
MailHandler mh = new MailHandler();
mh.SendMail(listRecipients, "Test Results " + tbName.Text, sb.ToString());

But I was getting the error...Gridview must be placed inside a form tag with runat=server. And of course it is, and the panel and the label are not throwing a similar error. I found this nifty fix:

public override void VerifyRenderingInServerForm(Control control)
{ 
return;
}

found it here: http://blogs.x2line.com/al/archive/2004/10/08/576.aspx

Friday, August 20, 2010

Downloading Multiple Files as a Zip File Using GridView and SharpZipLib

Abstract:
Downloading files becomes a painful procedure if you have to select each individual file manually to perform the download. In this article we are going to select multiple files and download all of them as a single zip file. 

Download SharpZipLib: 

SharpZipLib is a free .NET API which is used to perform zipping operations. We will use SharpZipLib to perform the file zip.

Displaying the Files on the GridView Control: 

We have created a folder in our application called "Files" which contains several text files. The first task is to display these files in the GridView control. The implementation is shown below: 



Follow the link :http://www.highoncoding.com/Articles/597_Downloading_Multiple_Files_as_a_Zip_File_Using_GridView_and_SharpZipLib.aspx

Tuesday, May 18, 2010

Check If User Name Exists Using AJAX And C#

Check If User Name Exists Using AJAX And C#

check folder / directory is exist or not...


check folder / directory is exist or not...


bool exists = System.IO.Directory.Exists(@"c:\myPath");

Monday, May 3, 2010

Split a path into a string[] in C# .net




using System.Text.RegularExpressions;

string inputString = @"C:\somedir\somefile.txt";
string[] parts = Regex.Split(inputString,@"\\");
foreach (string s in parts)
{
// process the strings
}

Answer

s[0]=C:
s[1]= somedir;
s[2]=somefile.txt

Saturday, May 1, 2010

Add/Change Page Meta tags dynamically in asp.net using C#.

Meta tags are very much important for you web page, search engine use Meta tags to index you site. So some time we need to change meta tags dynamically in case of dynamic pages in asp.net.

Create a web application in c#

Drag a button and one textbox on the form

Then write code on form load event

C#

protected void Page_Load(object sender, EventArgs e)

{

HtmlHead headTag = (HtmlHead)this.Header;

// Set the page title

headTag.Title = "Title of Page";

// Add a Description meta tag

HtmlMeta PagemetaTag = new HtmlMeta();

PagemetaTag.Name = "Description";

PagemetaTag.Content = "Customized Description tag of the page";

headTag.Controls.Add(PagemetaTag);

// Add a Keywords meta tag

PagemetaTag = new HtmlMeta();

PagemetaTag.Name = "Keywords";

PagemetaTag.Content = "Customized Keyword tag of the page";

headTag.Controls.Add(PagemetaTag);

}

VB

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim headTag As HtmlHead = CType(Me.Header, HtmlHead)

' Set the page title

headTag.Title = "Title of Page"

' Add a Description meta tag

Dim PagemetaTag As HtmlMeta = New HtmlMeta()

PagemetaTag.Name = "Description"

PagemetaTag.Content = "Customized Description tag of the page"

headTag.Controls.Add(PagemetaTag)

' Add a Keywords meta tag

PagemetaTag = New HtmlMeta()

PagemetaTag.Name = "Keywords"

PagemetaTag.Content = "Customized Keyword tag of the page"

headTag.Controls.Add(PagemetaTag)

End Sub

This is the simple code to change meta tags of your page dynamically.

Wednesday, April 28, 2010

Configure Session Time-out (IIS 7)


User Interface

To Use the UI
  1. Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).

  2. In Features View, double-click ASP.






  1. On the ASP page, under Services, expand Session Properties.

  2. In the Time-out field, enter a time-out value in the format hh:mm:ss. For example, enter 00:15:00 for 15 minutes.

  3. In the Actions pane, click Apply.

























Tuesday, April 20, 2010

Display Hierarchical Data with TreeView in ASP.NET 2.0

Check This link


Steps to Create and Deploy SSIS Package as a SQLAgent Job

Microsoft says that SQL Server Integration Services (SSIS) “is a platform for building high performance data integration solutions, including extraction, transformation, and load (ETL) packages for data warehousing.” A simpler way to think of SSIS is that it’s the solution for automating SQL Server. SSISprovides a way to build packages made up of tasks that can move data around from place to place and alter it on the way. There are visual designers (hosted within Business Intelligence Development Studio) to help you build these packages as well as an API for programming SSIS objects from other applications.


as an API for programming SSIS objects from other applications.

Though SSIS is almost infinitely customizable, Microsoft has produced a simple wizard to handle some of the most common ETL tasks: importing data to or exporting data from a SQL Server database. The Import and Export Wizard protects you from the complexity of SSIS while allowing you to move data between any of these data sources:

  • SQL Server databases
  • Flat files
  • Microsoft Access databases
  • Microsoft Excel worksheets
  • Other OLE DB providers

SQL Server 2005 redesigned the way you design data transformation packages. It now includes much more capabilities, and because of that, it features a new tool. It separates the control of the package from the data transformation portion, so you can do much more. For instance, you have the ability to read information from WMIor a web service. There is also the ability to iterate through a loop of data stored in a variable, or from a result set.

Creating a Package

The Import and Export Wizard is easy to use, but it only taps a small part of the functionality of SSIS. To really appreciate the full power of SSIS, you’ll need to use BIDS to build an SSIS package. A package is a collection of SSIS objects including:

  • Connections to data sources.
  • Data flows, which include the sources and destinations that extract and load data, the transformations that modify and extend data, and the paths that link sources, transformations, and destinations.
  • Control flows, which include tasks and containers that execute when the packageruns. You can organize tasks in sequences and in loops.
  • Event handlers, which are workflows that runs in response to the events raised by a package, task, or container.

Step 1: Open SQL Server Business Intelligence Development Studio.

SSIS_SQLAgent_1

Step 2: Create a New Project

SSIS_SQLAgent_2

Step 3: Select Integration Services Project under Business Intelligence Projects and provide a name for the project.

SSIS_SQLAgent_3

Step 4: Add a new Data Source. Right Click on Data Sources and select New Data Source.

SSIS_SQLAgent_4

Step 5: Use the Data Source Wizard to add a new data source. Select ‘Create a data source based on an existing or new connection’ and click on ‘New’.

SSIS_SQLAgent_5

Step 6: Add the Server and Authentication information and click on Test Connection to test the connection. Then click OK.

SSIS_SQLAgent_6

Step 7: A default SSIS package is created under the solution called Package.dtsx. Rename this package with a meaningful name.

SSIS_SQLAgent_7

Step 8: Drag and drop Control Flow Items from the Toolbox on the left to the Control Flow diagram and create the package.

SSIS_SQLAgent_8

Step 9: Double Click on the Data Flow Task to edit each Data Flow and add data transformations.

SSIS_SQLAgent_9

Step 10: Save and Build the package.

SSIS_SQLAgent_10

Step 11: Run the package. On successful completion, the tasks will turn green.

SSIS_SQLAgent_11

Deploying a Package

Step 1: Save a copy of the package on any server.

SSIS_SQLAgent_2_1

Note: If the package is to be deployed on a different server, ensure that the Protection Level is selected as EncryptSensitiveWithPassword

SSIS_SQLAgent_2_2

Provide a Password for the package by clicking on the PackagePassword Item and enter the password.

SSIS_SQLAgent_2_3

Step 2: Select Package location as SQL Server, Server Name as destination server and Authentication Type as Windows Authentication. Click on Package Path to browse and save the package.

SSIS_SQLAgent_2_4

Step 3: Save the package under SSIS Packages.

SSIS_SQLAgent_2_5

Step 4: Open SQL Server Management Studio and connect to the Database Engine on the server where you have saved the Package.

SSIS_SQLAgent_2_6

Step 5: Go to SQL Server Agent -> Job. Right-click and select New Job.

SSIS_SQLAgent_2_7

Step 6: Provide a name for the Job.

SSIS_SQLAgent_2_8

Step 7: Go to Steps and click ‘New’.

SSIS_SQLAgent_2_9

Step 8: Provide a name for the Step and select the Type as SQL Server Integration Services Package.

SSIS_SQLAgent_2_10

Step 9: Select Package Source as SQL Server, Server as the destination server and click on Package to browse and select the package.

SSIS_SQLAgent_2_11

Step 10: Click on data Source tab. Provide a password when prompted (if saved with a password).

SSIS_SQLAgent_2_12

Step 11: Edit the Connection String to add password for OLE DB connections, or change location of Input/Output files if required. Click Ok to save the changes.

SSIS_SQLAgent_2_13

Step 12: Go to Schedules and click New to add a new schedule.

SSIS_SQLAgent_2_14

Step 13: Click Ok on the Job Schedule Properties window to save the schedule.

Step 14: Click Ok on the Job properties window to save the job.


refrence :http://technotes.towardsjob.com/sql-server/steps-to-create-and-deploy-ssis-package-as-a-sqlagent-job/