You can try these.
Ramesh S 129 Posting Pro
gtyler121 commented: This answered my question +0
I already said that I wrote the query in notepad and didn't check the syntax. However I re-write the query and tested it.
CREATE PROCEDURE Searching
(
@First_Name VARCHAR(50),
@Last_Name VARCHAR(50),
@AGE int
)
AS
BEGIN
DECLARE @Condition VARCHAR(200)
DECLARE @SELECTSTMT VARCHAR(500)
SET @Condition = ''
SET @SELECTSTMT = 'SELECT First_Name, Last_Name, AGE FROM Your_Table '
IF (@First_Name IS NOT NULL OR @First_Name <> '')
BEGIN
SET @Condition = 'FIRST_NAME = ''' + @First_Name + ''''
END
IF (@Last_Name IS NOT NULL OR @Last_Name <> '')
BEGIN
SET @Condition = @Condition + CASE WHEN @Condition <> '' THEN ' AND ' ELSE '' END
SET @Condition = @Condition + 'LAST_NAME = ''' + @Last_Name + ''''
END
PRINT @Condition
IF (@AGE IS NOT NULL OR @AGE <> 0)
BEGIN
SET @Condition = @Condition + CASE WHEN @Condition <> '' THEN ' AND ' ELSE ' ' END
SET @Condition = @Condition + 'AGE = ' + CAST(@AGE AS VARCHAR(10))
END
IF @Condition <> ''
BEGIN
SET @SELECTSTMT = @SELECTSTMT + ' WHERE ' + @Condition
END
EXECUTE @SELECTSTMT
--PRINT @SELECTSTMT
END
You can call this query in C# and bind the resulting datatable to DataGrid.
Otherwise if need to search within DataGrid using the DataTable which you bind to it, you can use DataView to filter the DataTable as below
DataView dv = new DataView(dtCustomer); //dtCustomer is a DataTable
dv.RowFilter = "First_Name = '" + txtFirstName.Text + "'";
DataGrid1. DataSource= dv;
DataGrid1.DataBind();
Hi,
Try to use satellite assemblies to implement this. Using satellite assemblies, you can place the resources for difference languages in different assemblies, and the correct assembly is loaded into memory only if the user elects to view that application in that language.
Creating Satellite Assemblies
Create a Multi-Lingual Site with Localization?
Satellite Assembly - Multi Languages
Building Multilingual Web Sites with ASP.NET
If you are binding the DataGrid with database, You can call the above stored procedure to search in the DataGrid.
1. From product page, you can pass the selected value of the dropdown list through session or query string.
2. In shopping cart page, in the RowDataBound event of GridView, find the dropdownlist control from the GridView row and set selected value to the value received from session or query string.
Have you tried ValidationGroup property.?
Validation groups allow you to organize validation controls on a page as a set. Each validation group can perform validation independently from other validation groups on the page.
Check the following links.
ASP.NET ValidationGroup Property
Validation Groups in ASP.NET 2.0
Specifying Validation Groups
Do you want to this operation in client side or server side?
Since it is a web application, you can't use the above C# code at client side. It can be done using JavaScript only.
You can try to use object.execCommand javascript method to paste the text from clipboard to the current object such as TextBox.
For example,
function PasteTextFromClipboard()
{
document.getElementById('textArea1').focus();
var strText = document.getElementById('textArea1').createTextRange();
strText.execCommand("Paste");
}
In case if you want to do this operation in server side, check the following article. The C# code uploads a word document file and stores it into a string and from that it is placed that string into a textbox.
It means that you didn't configure the InsertCommand property and corresponding InsertParameters in SqlDataSource.
Take a look the following articles.
Using the Insert feature of SqlDataSource with Gridviews
Accessing and Updating Data in ASP.NET: Inserting Data
Create a stored procedure as below and pass the first name, last name and age values as parameters to the stored procedure. The query will be constructed dynamically based on the values of the parameteres. You may need to check the syntax of the query as I typed in notepad.
CREATE PROCEDURE
(
@First_Name VARCHAR(50),
@Last_Name VARCHAR(50),
@AGE_Name int
)
AS
BEGIN
DECLARE @Condition VARCHAR(200)
DECLARE @SELECTSTMT VARCHAR(500)
SET @Condition = ''
@SELECTSTMT = 'SELECT First_Name, Last_Name, AGE FROM Your_Table '
IF (@First_Name IS NOT NULL oR @First_Name <> '')
BEGIN
SET @Condition = 'FIRST_NAME = ''' + @First_Name + ''''
END
IF (@Last_Name IS NOT NULL OR @Last_Name <> '')
BEGIN
SET @Condition = @Condition + CASE WHEN @Condition <> '' THEN ' AND ' ELSE '' END
SET @Condition = @Condition + 'LAST_NAME = ''' + @Last_Name + ''''
END
IF (@AGE NOT NULL OR @AGE <> 0)
BEGIN
SET @Condition = @Condition + CASE WHEN @Condition <> '' THEN ' AND ' ELSE ' ' END
SET @Condition = @Condition + 'AGE = ' + @AGE
END
IF @Condition <> ''
BEGIN
SET @SELECTSTMT = @SELECTSTMT + ' WHERE ' + @Condition
END
EXECUTE @SELECTSTMT
END
The following line reads the database connection information from web.config file.
35. Dim myConn As New SqlConnection(ConfigurationManager.ConnectionStrings("cs").ConnectionString)
The sql server connection details can be stored in web.config something like as below.
<appSettings>
<add key="cs" value="Server=YourServerName;Database=Northwind;User Id=testuser;Password=somepassword;" />
</appSettings>
You can also specify the connection details in the code itself
Dim myConn As New SqlConnection("Server=YourServerName;Database=Northwind;User ID=testuser;Password=somepassword;")
Take a look at the following links.
Sending Appointments to an Outlook 2007 Calendar from an ASP.NET 2.0 Web Site
Check the following link which tells you about data types supported by web service.
Data Types Supported by XML Web Services Created Using ASP.NET
You can the following ways,
1. Store the pairs in a DataSet and return it from your web method.
2. The above link says that arrays of classes is supported by web method. So create a class having two properties to store name, value pair and create an array of objects for that class and return it from web method.
Or check the following article.
To read the content of PDF files in C#,
http://jadn.co.uk/w/ReadPdfUsingCsharp.htm
To export HTML to PDF,
http://stackoverflow.com/questions/589852/export-from-html-to-pdf-c
You have enabled impersonation with Windows Authentication. Therefore the web applications run under the user's account who access the web site from browser. Therefore the user account should have read/write access to the IMAGES folder in the server where the application is running.
Also the asp.net application runs under ASPNET account in Windows XP and Network Service account in Windows 2003, you need to provide to read/write access to the folder for these accounts.
Why do you set the UseSubmitBehavior property of the Button to true? Is there a specific reasone? If no, remove that property.
1. Open Windows Explorer
2. Right click on the folder
3. Select Properties menu. It will oen Properties windows
4. Click Security tab.
5. Click Add button and enter Network Service and click OK.
This is required only if you deployed your application in IIS on Windows 2003. For Windows XP deployment, you need to provide access to ASPNET Account
You can divide your web application into a 3-tier architecture namely 1. Presentation Layer 2. Business Layer 3. Data Access layer.
1. Presentation Layer
You can put your .aspx files, images, user controls, javascript files, css files etc in this UI layer. Create separate folders to have image, JavaScript, CSS files in this layer. Basically a web site or web application in Visual Studio will be created as a presentation layer.
2. Business Layer
You need to implement business logic components related to your application in this layer. Business layer is generally implemented as a class library in VS 2005/2008. A reference to this project will be added in presentation layer and the classes of this layer will be instantiated and its method will be called in presentation layer classes.
3. Data Access Layer
Your data access logic will be implemented in this layer. It will be implemented as a class library in VS 2005/2008. A reference to this project will be added in business layer. The classes and methods of this layer can only be used in business layer and cannot directly be used in presentation layer.
Check these links.
Three Tier Architecture in ASP.NET
3-Tier Architecture in ASP.NET with C#
The built-in feature of .NET String class has methods to remove spaces in a given string. Why do you want to go for a custom method?
String str1 = "This is a string"
String str2 = str1.Replace(" ", String.Empty)
Here str2 will have the string value "Thisisastring".
Hi Claude2005 ,
Yes.You need to provide permission to access to a folder to ASPNET account if you are running your website in Windows XP. Also you need to provide access to the folder to Network Service account if you are running your web site in Windows Server 2003.
What is the functionality of UserDALC() method?
It seems that this method performs some database operation in the back end database which leads to a performance problem.
If so, execute the query or stored procedure and check the time taken to complete the operation. If it takes too long, try to optimize the query and also check if indexes are exists for the fields used in the WHERE clause of the query.
You can try to call the SetDatabaseLogon() method of your report with your server name, database name, user name and password.
Try the solution given in the following link.
http://www.daniweb.com/forums/thread155854.html
http://forums.asp.net/p/1131058/1793009.aspx
http://vb.net-informations.com/crystal-report/vb.net_crystal_report_load_dynamically.htm
You need to set index.htm as the default document in IIS.
Check this link.
Setting Up Default Documents (IIS 6.0).
If you are using a web hosting company to deploy you site over internet, you can ask them to set index.html as default document for your site.
Since you are updating a table based on some condition like UserName = ' " + Text1.Text + " ', the condition may not fail as there may not be a UserName in the Registration table satisfying the condition.
Just copyt the UPDATe statement generated by Response.Write into SQL Management studio and check how many rows are updated.
1. First you need decide the platform such as .NET or Java to develop your project.
2. Learn the relevant programming language.
3. Choose a requirement for the project development of the project. It can be Sale management, Leave management system etc
4. Design the database for the requirement and create the database
5. Write code in .NET or Java for the requirement with the database
Take a look at the following link.
Connecting to a Microsoft Access database with ASP.NET
You can find some source code here.
Login page using MS Access Database
Login Page in asp.net using C# using MS access database
The ASP.NET MVC Framework is a web application framework that implements the Model-view-controller pattern. It allows software developers to build a Web application as a composition of three roles: Model, View and Controller.
Check the following links to see more details.
Hi kailasgorane,
Please mark this thread as solved if your question is answered.
Regards
Ramesh. S
Since you want to open Outlook using asp.net, you can use JavaScript outlook to open Outlook at client PC. Try the following links. To pass data to outlook using javascript, you may use command line parameters when opening Outlook using javascirpt. Check the following links.
Opening Outlook through javascript
Sending Email From JavaScript using OutLook Automation
Command-line switches
Hi,
Your code is working fine for me.
Are you checking your code in IIS on Windows XP(your development machine) or any Windows Server or the built-in web server comes with VS 2008?
Your code is working fine with VS 2008 with built-in web server and also VS 2008 with local IIS on Window XP.
Hi cjsteury,
Please mark this thread as answered if your question is answered.
Regards
Ramesh. S
If see ViewSource of the HTML for your page, <%=SearchCriteriaTextBox.ClientID %> is not rendered properly.
You can change your code as below
<asp:TextBox ID="SearchCriteriaTextBox" runat="server" Text="Enter Search Criteria" Width="150px" ForeColor="GrayText" OnClick="this.value = ''; this.style.color = 'black'" OnBlur="javascript:changeText(this.id)" />
Hope the following articles will help you to setting up database in ix web hosting.
Setting Up Database Connection on IxWebHosting
Configuring Web.config for database access - IxWebHosting
Setting the z-index property (HTML) using CSS can address this problem. The CSS class would look something like this:
.adjustedZIndex {
z-index: 1;
}
And the Menu should look like as below
<asp:Menu ID="Menu1" runat="server">
<DynamicMenuStyle CssClass="adjustedZIndex" />
</asp:Menu>
The z-index has to be something higher.
Some fixes have been in the following links. Try them.
ASP.NET Menu and IE8 rendering white issue
Ie8 doesn't seem to like the ASP.Net Menu control
asp:Menu in IE8
asp:menu fix for IE8 problem available
When you add a web page to your web site/web application, You can add a master to the web page by selecting 'Select master page' checkbox in the 'Add New Item' dialogbox. It will open a dialogbox where you can select the master page for the web page.
Refer these links also.
The login control uses ASP.NET membership provider to authenticate the user. The membership provider is basically SQL server database and connection is specified in the web.config. Therefore you application was working fine as your application was able to connect with SQL server membership database. But your application may not be able to connect with SQL server database from your web server. Therefore change connection details for membership prvider in the web server configuration file.
You are trying to insert values in a column in a table greater than the max length of the column specified.
Either increase the column width for the table in the database or check the length of the column values in your code before inserting into table.
Browser close event cannot determined accurately by code. Therefore you cannot re-count the online users if browser is closed by the user.
The javascript onbeforeunload event can be used to detect the browser close. But it will also get fired if the user click a link to go to another page. Also the onbeforeunload will not be supported some browsers other thatn IE.
You cannot build Excel document at client side using C#.
You can use ActiveX object in JavaScript to build Excel document which will work in IE only.
Using ActiveX object in JavaScript is not a good solution and the code is complex and debugging is not possible.
If you try to insert a huge DataTable directyly to Excel using a for loop, it will take more time and even throw memory exception. But if you convert huge DataTable into ArrayList and then write the ArrayList to Excel, it will reduce a lot of time. I have tried this approach and succeeded.
The solution given in the article is to insert bulk/huge data into Excel using Array List.
Convert the DataTable into a two dimensional array and the pass the array to the Excel COM object.
The Excel object modal accepts arrays and writes the content into Excel worksheet.
Try the following link.
There are plenty of open source blog software available for asp.net.
Try the following links.
When you set the TextMode to 'Password', actually the textbox is rendered as below
<input type="password" name="TextBox1">
If you set TextMode to 'SingleLine, the textbox is rendered as below
<input type="Text" name="TextBox1">
Both HTML INPUT controls are different.
Also the type property in the INPUT control is read only and cannot be changed using JavaScript.
But You can use two different TextBoxes, one for Text mode and another one for Password mode. And show and hide them using JavaScript.
See some sample code in the following link.
This error might be occured if any of image url used in css, javascript and html is incorrect or the image file is missed in the folder where your images exists.
Check whether all files referenced in your web page exist in the web site folder.
You can try to find the error details by putting some extra logging into the Application_Error event code - something like:
void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
// Log the error information.
log.Error("Application_Error in: " + HttpContext.Current.Request.Url.ToString(), ex);
}
Where 'log.Error()' should write the log details into some medium or store the information into a string variable and put a break point on it.
If you want to use barcode scanner, you need to use a third party activex control which supports it. It will work in IE only.
I believe you want to use barcode scanner in WinForms application. Please post the WinForms question in C# Forum in future.
you will need different code for each type of scanner you are using. Check whether your scanner maufacturer provide any SDK to program your scanner.
Also look into OpenNETCF's Smart Device Framework which provides class libraries to build smart device applications.
The number of '?' in your DeleteCommand and UpdateCommand does not match with the number of parameters defined in DeleteParameters amd UpdateParameters collection.