Disable Default Sorting In datagridview
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
Here we re going to see how disable default sorting in datagridview. We can do this by either by code or by design. We will see it in step by step.
Disabling Default Sorting at design
To start right click on datagridview -> select edit columns
add a column -> then in the column properties give sortmode to either
programatic or none or anything you want
Disabling Default Sorting at Program
Another way is in the program write code as below
foreach (DataGridViewColumn col in dataGridView1.Columns)
{
col.SortMode = DataGridViewColumnSortMode.NotSortable;
}
Sorting Datagridview Columns
When giving datasource to datagridview we can sort rows of datagridview
see the example below
DataTable dt = GetTbl();
dt.DefaultView.Sort=dataGridView1.Columns[0].Name+"ASC"; //OR DESC
datagridview1.datasource=dt;
GOR BLESS YOU
MOTHER MARY PRAY FOR US
Ref: ID Card Printing Software
Monday, November 24, 2008
Saturday, October 11, 2008
Question:How can u insert javascript in mail body using system.net.mail or system.web.mail
Hi Guys,
I have created a background service which send the email of birthday list of all employees who's birthday's are fall on present month. on 1st of every month to the manger .once manager receives email and clicks add reminder button on the email which he has received then he should be able to add that details as a reminder in outlook.
So presently I am attaching the client script also the same email body and calling that script on hyper link click. But when manager receives email that hyper link is displaying like a text . but see the original content of the email by selecting the "see original message" and copy the same content as ".html" then it is working as expected. ---it is showing the href and by click on that the information added to outlook. Same body is not working on the mail.
Please give me some inputs on this.
Thanks in advance
Naveen.
discussion1:
Most mail clients will not allow for javascript inside the email body.
discussion2:
could please send any examles on it. i just used the below code to send the email with embeded javascript.
with the below code i am able to send the email with one buttion. but while clicking on it no action is performed. but if you see the orginal content of the mail and pasted this in another notepad and save it something like "1.html" and open it. then javascript is firing . what is the main differnce while it is in email body. is there have any alternatives to work on client side.
discussion3:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
MailMessage msg = new MailMessage();
msg.From = naveen.bandla@msn.com;
msg.To = naveen.bandla@gmail.com;
msg.Subject = "test for smtp";
msg.BodyFormat = MailFormat.Html;
msg.Body = " function onclickme(){alert(\"hai\")} hai";
SmtpMail.SmtpServer = "";
SmtpMail.Send(msg); Response.Write("mail send"); }
catch(Exception ex) { Response.Write(ex.Message); } }
} Read more : Fingerprint Scanner Supplier in Dubai
Hi Guys,
I have created a background service which send the email of birthday list of all employees who's birthday's are fall on present month. on 1st of every month to the manger .once manager receives email and clicks add reminder button on the email which he has received then he should be able to add that details as a reminder in outlook.
So presently I am attaching the client script also the same email body and calling that script on hyper link click. But when manager receives email that hyper link is displaying like a text . but see the original content of the email by selecting the "see original message" and copy the same content as ".html" then it is working as expected. ---it is showing the href and by click on that the information added to outlook. Same body is not working on the mail.
Please give me some inputs on this.
Thanks in advance
Naveen.
discussion1:
Most mail clients will not allow for javascript inside the email body.
discussion2:
could please send any examles on it. i just used the below code to send the email with embeded javascript.
with the below code i am able to send the email with one buttion. but while clicking on it no action is performed. but if you see the orginal content of the mail and pasted this in another notepad and save it something like "1.html" and open it. then javascript is firing . what is the main differnce while it is in email body. is there have any alternatives to work on client side.
discussion3:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
MailMessage msg = new MailMessage();
msg.From = naveen.bandla@msn.com;
msg.To = naveen.bandla@gmail.com;
msg.Subject = "test for smtp";
msg.BodyFormat = MailFormat.Html;
msg.Body = " function onclickme(){alert(\"hai\")} hai";
SmtpMail.SmtpServer = "";
SmtpMail.Send(msg); Response.Write("mail send"); }
catch(Exception ex) { Response.Write(ex.Message); } }
} Read more : Fingerprint Scanner Supplier in Dubai
Tuesday, June 24, 2008
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
Hello all,
I am using sqlserver and visual studion 2005. And i am using SqlClient to connect with sql server and vs framework. My connectionstring is
SqlConnection sqlCon = new SqlConnection("Data Source=(local);user id=sa;password=;Initial Catalog=testUtilities");
When trying to open connection the following error message is shown
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
If anyone knows the exact reason please help me.
Thanks in Advance
John Sakaria
I am using sqlserver and visual studion 2005. And i am using SqlClient to connect with sql server and vs framework. My connectionstring is
SqlConnection sqlCon = new SqlConnection("Data Source=(local);user id=sa;password=;Initial Catalog=testUtilities");
When trying to open connection the following error message is shown
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
If anyone knows the exact reason please help me.
Thanks in Advance
John Sakaria
Tuesday, May 6, 2008
Event logging
Event Logging
Windows 2000 and Windows XP have an important feature called Event Log a database containing important information about hardware and software events. The event log is useful for recording information about the status of your applications and provides system administrators a means of diagonosing problems, Since they can review event log entries using the event viewer(supplied with Windows and available in administrative tools group in the control panel). There are three types of event log events:
Informational Events
Usualy Contains information, such as an application starting or shutting down.
Warning Events
Usally provides information about unusual conditions that have the potential to become errors.
Error Events
Represent critical errors in an application that prevent it from executing normally.
Event are stored in Event logs - Windows supports three types of event logs
Application: Contains messages that applications such as Microsoft SQL Server.
System: Contains messages that device drivers and system service log.
Security: Contains system generated message about events that occur whwn security auditing is emabled
The .NET framework makes it easy to work with event log as shown in the following code
Imports System;
Imports System.Diagnostics;
Module eventLogDemo
Sub Mail()
IF Not EventLog.SourceExists("AspnetBible") Then
EventLog.CreateEventSource(("AspnetBible" , "Application")
Console.WriteLine("Created New Event Source 'ASPnetBible'")
End If
Dim evLog As New EventLog()
evLog.Source="ASPnetBible"
evLog.WriteEntry("...........Starting")
Console.WriteLine("Wrote starting...........")
evLog.WriteEntry("...........Exiting")
End Sub
End Module
The code is a Visual Basic .NET console application that creates an event souce
called ASPnetBible and write information about application stating and exiting events to the system's application event log
GOD BLESS YOU
Windows 2000 and Windows XP have an important feature called Event Log a database containing important information about hardware and software events. The event log is useful for recording information about the status of your applications and provides system administrators a means of diagonosing problems, Since they can review event log entries using the event viewer(supplied with Windows and available in administrative tools group in the control panel). There are three types of event log events:
Informational Events
Usualy Contains information, such as an application starting or shutting down.
Warning Events
Usally provides information about unusual conditions that have the potential to become errors.
Error Events
Represent critical errors in an application that prevent it from executing normally.
Event are stored in Event logs - Windows supports three types of event logs
Application: Contains messages that applications such as Microsoft SQL Server.
System: Contains messages that device drivers and system service log.
Security: Contains system generated message about events that occur whwn security auditing is emabled
The .NET framework makes it easy to work with event log as shown in the following code
Imports System;
Imports System.Diagnostics;
Module eventLogDemo
Sub Mail()
IF Not EventLog.SourceExists("AspnetBible") Then
EventLog.CreateEventSource(("AspnetBible" , "Application")
Console.WriteLine("Created New Event Source 'ASPnetBible'")
End If
Dim evLog As New EventLog()
evLog.Source="ASPnetBible"
evLog.WriteEntry("...........Starting")
Console.WriteLine("Wrote starting...........")
evLog.WriteEntry("...........Exiting")
End Sub
End Module
The code is a Visual Basic .NET console application that creates an event souce
called ASPnetBible and write information about application stating and exiting events to the system's application event log
GOD BLESS YOU
Simplified Development efforts
SIMPLIFIED DEVELOPMENT EFFORTS
Two aspects of creating Web-based applications present unique challenges to web developers: Visual page design and debugging application. Visual page design is straightforward when creating static content; however when you need to present the result of executing a query in a tabular format using ASP page, page design can get rather involved. This is because developers need to mix traditional Asp code, which represent the application’s logic and HTML, which represent the presentation of data. ASP.NET and .NET framework simply development by allowing developers to separate an applications logic from its presentation. Resulting in an easier to maintain code base. Asp.NET can also handle the details of maintaining state of controls, such as the contents of textboxes between calls to the same Asp page, therefore reducing the amount of code you need to write. Visual Studio .NET which is tightly integrated with .NET framework, assist developers as they create ASP.NET and other applications by providing visual designers that facilitate visual drag and drop editing making page layout and form layout a breeze.
Another aspect of creating applications is debugging. Developers sometimes make mistakes; Systems don’t behave as you expect them to and unexpected conditions arise-all of these issues are collectively referred to as, using the affectionate term ‘bugs’ tracking down bugs known as debugging. Developers must be familiar with variety of debugging tools sometimes available from third party, and techniques- A combination of programming techniques for using a particular tool. The .NET framework simplifies debugging with support for runtime diagnostics.
Runtime diagnostics not only help you track down bugs but also help you determine how will your applications perform and assess the condition of your application. The .NET framework provides three types of Runtime diagnostics
1. Event Logging
2. Performance Counter
3. Tracing
Two aspects of creating Web-based applications present unique challenges to web developers: Visual page design and debugging application. Visual page design is straightforward when creating static content; however when you need to present the result of executing a query in a tabular format using ASP page, page design can get rather involved. This is because developers need to mix traditional Asp code, which represent the application’s logic and HTML, which represent the presentation of data. ASP.NET and .NET framework simply development by allowing developers to separate an applications logic from its presentation. Resulting in an easier to maintain code base. Asp.NET can also handle the details of maintaining state of controls, such as the contents of textboxes between calls to the same Asp page, therefore reducing the amount of code you need to write. Visual Studio .NET which is tightly integrated with .NET framework, assist developers as they create ASP.NET and other applications by providing visual designers that facilitate visual drag and drop editing making page layout and form layout a breeze.
Another aspect of creating applications is debugging. Developers sometimes make mistakes; Systems don’t behave as you expect them to and unexpected conditions arise-all of these issues are collectively referred to as, using the affectionate term ‘bugs’ tracking down bugs known as debugging. Developers must be familiar with variety of debugging tools sometimes available from third party, and techniques- A combination of programming techniques for using a particular tool. The .NET framework simplifies debugging with support for runtime diagnostics.
Runtime diagnostics not only help you track down bugs but also help you determine how will your applications perform and assess the condition of your application. The .NET framework provides three types of Runtime diagnostics
1. Event Logging
2. Performance Counter
3. Tracing
Saturday, May 3, 2008
DIRECT SUPPORT FOR SECURITY
Developing an application that resides on a user’s desktop system and user’s local resource is easy, from security point of view, because security simply isn’t a consideration in this scenario. Security becomes much more important when you create applications that access data on remote systems. Or applications that perform privileged tasks on behalf of no privileged users because may have to authenticate users, and encryption (scrambling to avoid eavesdropping) may be necessary to secure data communications.
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
Windows NT, Windows 2000 and Windows XP have a number of security features based on access control lists (ACLs). An ACL contains number of entries that specify which users may access or are explicitly denied access to resource such as files and printers. ACL are great way of protecting executable files (applications) from unauthorized access, but they do not secure all parts of the file. The .Net framework enables both developers and system administrators to specify method level security. Developers (through easy-to-use programming language construct called attributes) and system administrators (by using administrative tools and by editing an application’s configuration file) can configure an applications security so that only authorized users can invoke a component’s methods.
The .NET framework uses industry standard protocols such as TCP/IP and means of communication such as the Extensible Markup Language (XML) , Simple Object Access Protocol (SOAP , a standard application messaging protocol) , and HTTP to facilitate distributed application communications. This makes distributed computing more secure, because .NET developers cooperate with network connectivity devices as opposed to attempting to work around there security restrictions.
Developing an application that resides on a user’s desktop system and user’s local resource is easy, from security point of view, because security simply isn’t a consideration in this scenario. Security becomes much more important when you create applications that access data on remote systems. Or applications that perform privileged tasks on behalf of no privileged users because may have to authenticate users, and encryption (scrambling to avoid eavesdropping) may be necessary to secure data communications.
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
Windows NT, Windows 2000 and Windows XP have a number of security features based on access control lists (ACLs). An ACL contains number of entries that specify which users may access or are explicitly denied access to resource such as files and printers. ACL are great way of protecting executable files (applications) from unauthorized access, but they do not secure all parts of the file. The .Net framework enables both developers and system administrators to specify method level security. Developers (through easy-to-use programming language construct called attributes) and system administrators (by using administrative tools and by editing an application’s configuration file) can configure an applications security so that only authorized users can invoke a component’s methods.
The .NET framework uses industry standard protocols such as TCP/IP and means of communication such as the Extensible Markup Language (XML) , Simple Object Access Protocol (SOAP , a standard application messaging protocol) , and HTTP to facilitate distributed application communications. This makes distributed computing more secure, because .NET developers cooperate with network connectivity devices as opposed to attempting to work around there security restrictions.
Wednesday, April 30, 2008
When discussing about the benefits of .NET Framework the first thing needs to consider is CONSISTENT PROGRAMMING MODEL is one merit of .NET FRAMEWORK.
CONSISTENT PROGRAMMING MODEL
Different programming for doing the same thing. For example the following code demonstrate how to open a file and write one line message to it using Visual Basic 6.0
Public Sub testFileAccess ()
On Error GoTo handle_Error
‘Use native method to opening and writing to a file….
Dim OutputFile As Long
OutputFile=FreeFile
Open “C:\temp\test.txt” For Output As #outputFile
Print #outputFile, “Hello World”
Close #outputFile
‘Use Microsoft scripting scripting runtime to open and write
‘To the file……………
Dim fso As Object
Set fso=CreateObject (“Scripting.FileSystemObject”)
Dim outputText As TextStream
Set OutputText=fso.CreateTextFile (“c:\temp\test2.txt”)
OutputText.Writeline “Hello World”
OutputText.Close
Set fso=Nothing
Exit Sub
handle_Error:
‘Handle or report error here
End Sub
This code demonstrates that more than one technique available to create and write to a new file. The first method uses Visual Basic’s built-in support; the second method uses Microsoft scripting runtime. C++ also offers more than one way of performing same task. The following is a sample demonstrates how to open a file and write a line to it using c++.
#include
#include
#include
#include
using namespace std:
int main(int argc, char* argv[])
{
//Using c runtime Library (CRT)………..
FILE *testFile;
If((testFile = fopen ( “c: \\ temp\\test3.txt”, “Wt”))==NULL){
{
cout<< “Could not open file testfile!” << endl;
return 1;
}
fprintf(testFile, “Hello world \n”);
fclose(testFile);
//Use standard template library
ofstream outputstream(“c:\\temp\\test4.txt”);
if(!outputstream)
{
cout<< “Could not open second test file”<< endl;
return(1);
}
OutputStream << “Hello World!” << endl;
OutPutStream.close ();
return 0;
}
What both code listing demonstrate is that when using different programming languages a disparity exists among the techniques that developers use to perform the same task. The difference in techniques comes from how different languages interact with and represent the underlying system that applications rely on, thereby increasing the amount of training developers need. The following code demonstrates how to perform the same task in Visual Basic.NET and Visual C#. NET.
Visual Basic.NET
Imports System.IO
Module Demo
Sub Main ()
Dim OutputFile As StreamWriter=New StreamWriter(“c:\temp\test5.txt”)
OutputFile.WriteLine(“Hello World!.”)
OutputFile.Close()
End Sub
Visual C#. NET
using System.IO;
using System.Text;
Class Demo{
static void Main(){
StreamWriter outputfile=new StreamWriter(“c:\\temp\\test6.txt”);
OutputFile.WruteLine(“Hello World”);
OutputFile.Close();
}
The preceding code demonstrates, apart from slight syntactical differences, the technique for writing the file in either language is identical- Both listing use the StreamWriter class to write the “Hello world” message out to the text files. In fact unlike Visual Basic and Visual C++ listings there’s more than one way to do something within the same language, the preceding listing show that there is unified means of accomplishing the same task using the .NET class library.
The .NET class Library is a key component of a .Net framework-it is sometimes reffered to as Base Class Library(BCL) .The .NET Class Library contains 100s of classes you can use for tasks such as the following:
1. Processing XML.
2. Working with data from multiple sources.
3. Debugging your code and working with event logs.
4. Working with data streams and streams.
5. Managing the run-time environment.
6. Developing web services, components, and standard windows applications .
7. Working with application security.
8. working with directory services
The functionality that the .Net class library provides is available to all .net languagesresulting in a consistent object model regardless of the programming language developers use.
CONSISTENT PROGRAMMING MODEL
Different programming for doing the same thing. For example the following code demonstrate how to open a file and write one line message to it using Visual Basic 6.0
Public Sub testFileAccess ()
On Error GoTo handle_Error
‘Use native method to opening and writing to a file….
Dim OutputFile As Long
OutputFile=FreeFile
Open “C:\temp\test.txt” For Output As #outputFile
Print #outputFile, “Hello World”
Close #outputFile
‘Use Microsoft scripting scripting runtime to open and write
‘To the file……………
Dim fso As Object
Set fso=CreateObject (“Scripting.FileSystemObject”)
Dim outputText As TextStream
Set OutputText=fso.CreateTextFile (“c:\temp\test2.txt”)
OutputText.Writeline “Hello World”
OutputText.Close
Set fso=Nothing
Exit Sub
handle_Error:
‘Handle or report error here
End Sub
This code demonstrates that more than one technique available to create and write to a new file. The first method uses Visual Basic’s built-in support; the second method uses Microsoft scripting runtime. C++ also offers more than one way of performing same task. The following is a sample demonstrates how to open a file and write a line to it using c++.
#include
#include
#include
#include
using namespace std:
int main(int argc, char* argv[])
{
//Using c runtime Library (CRT)………..
FILE *testFile;
If((testFile = fopen ( “c: \\ temp\\test3.txt”, “Wt”))==NULL){
{
cout<< “Could not open file testfile!” << endl;
return 1;
}
fprintf(testFile, “Hello world \n”);
fclose(testFile);
//Use standard template library
ofstream outputstream(“c:\\temp\\test4.txt”);
if(!outputstream)
{
cout<< “Could not open second test file”<< endl;
return(1);
}
OutputStream << “Hello World!” << endl;
OutPutStream.close ();
return 0;
}
What both code listing demonstrate is that when using different programming languages a disparity exists among the techniques that developers use to perform the same task. The difference in techniques comes from how different languages interact with and represent the underlying system that applications rely on, thereby increasing the amount of training developers need. The following code demonstrates how to perform the same task in Visual Basic.NET and Visual C#. NET.
Visual Basic.NET
Imports System.IO
Module Demo
Sub Main ()
Dim OutputFile As StreamWriter=New StreamWriter(“c:\temp\test5.txt”)
OutputFile.WriteLine(“Hello World!.”)
OutputFile.Close()
End Sub
Visual C#. NET
using System.IO;
using System.Text;
Class Demo{
static void Main(){
StreamWriter outputfile=new StreamWriter(“c:\\temp\\test6.txt”);
OutputFile.WruteLine(“Hello World”);
OutputFile.Close();
}
The preceding code demonstrates, apart from slight syntactical differences, the technique for writing the file in either language is identical- Both listing use the StreamWriter class to write the “Hello world” message out to the text files. In fact unlike Visual Basic and Visual C++ listings there’s more than one way to do something within the same language, the preceding listing show that there is unified means of accomplishing the same task using the .NET class library.
The .NET class Library is a key component of a .Net framework-it is sometimes reffered to as Base Class Library(BCL) .The .NET Class Library contains 100s of classes you can use for tasks such as the following:
1. Processing XML.
2. Working with data from multiple sources.
3. Debugging your code and working with event logs.
4. Working with data streams and streams.
5. Managing the run-time environment.
6. Developing web services, components, and standard windows applications .
7. Working with application security.
8. working with directory services
The functionality that the .Net class library provides is available to all .net languagesresulting in a consistent object model regardless of the programming language developers use.
Subscribe to:
Posts (Atom)