protected void grdauditDocumentDetail_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Del")
{
pclsAuditDocumentsqlDL obj = new pclsAuditDocumentsqlDL();
clsAuditDocumnetSqlBL objAuditDoc = new clsAuditDocumnetSqlBL();
int Docid = Convert.ToInt32(e.CommandArgument);
// Convert.ToInt32((row.FindControl("lblDocid") as Label).Text);
objAuditDoc.DeleteAuditDocbyAuditDocid(Docid);
fillgrdAuditDetail();
lblMsg.Text ="Record Deleted Successfully!";
}
if (e.CommandName == "Download")
{
Downolad(e.CommandArgument.ToString(), System.IO.Path.GetExtension(e.CommandArgument.ToString()));
}
}
private void Downolad(string filename, string ext)
{
string type = "";
switch (ext.ToLower())
{
case ".htm":
case ".html":
type = "text/HTML";
break;
case ".txt":
type = "text/plain";
break;
case ".doc":
case ".rtf":
type = "Application/msword";
break;
case ".jpg":
case ".jpeg":
type = "Application/jpg";
break;
case ".xls":
type = "Application/xls";
break;
case ".pdf":
type = "Application/pdf";
break;
}
long FileSize;
string path = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + ConfigurationManager.AppSettings["AuditDocumentspath"] + "/" + filename;
if (File.Exists(path))
{
System.IO.FileStream MyFileStream = new System.IO.FileStream(path, System.IO.FileMode.Open);
FileSize = MyFileStream.Length;
byte[] Buffer = new byte[(int)FileSize + 1];
MyFileStream.Read(Buffer, 0, (int)MyFileStream.Length);
MyFileStream.Close();
Response.ContentType = "application/" + type;
Response.AddHeader("content-disposition", "attachment; filename=" + filename + ";");
Response.BinaryWrite(Buffer);
Response.End();
}
else
{
MessageBox.Show(this, "File Does not exist in Directory!");
}
}
Wednesday, July 28, 2010
Saturday, July 24, 2010
Listbox options javascript select all,move left-right, move up-down
Listbox options javascript select all,move left-right, move up-down
http://viralpatel.net/blogs/2009/06/listbox-select-all-move-left-right-up-down-javascript.html
Select content from one list to another using jQuery
http://www.akchauhan.com/select-content-from-one-list-to-another-using-jquery/
jquery cool examples,realy nice
http://web.enavu.com/tutorials/top-10-jquery-snippets-including-jquery-1-4/
http://www.devx.com/getHelpOn/10MinuteSolution/16372/1954
http://www.techinterviews.com/javascript-interview-questions-and-answers
http://viralpatel.net/blogs/2009/06/listbox-select-all-move-left-right-up-down-javascript.html
Select content from one list to another using jQuery
http://www.akchauhan.com/select-content-from-one-list-to-another-using-jquery/
jquery cool examples,realy nice
http://web.enavu.com/tutorials/top-10-jquery-snippets-including-jquery-1-4/
http://www.devx.com/getHelpOn/10MinuteSolution/16372/1954
http://www.techinterviews.com/javascript-interview-questions-and-answers
Wednesday, July 21, 2010
api finder/tokbox c# api
http://www.apifinder.com/APIFinder/APIDisplay/29771
http://code.google.com/p/tokboxapi/downloads/list
http://code.google.com/p/tokboxapi/downloads/list
Monday, July 19, 2010
Delegates in C#
Delegates in C#
Most programmers are used to passing data in methods as input and output parameters.
Imagine a scenario where you wish to pass methods around to other methods instead of data. Amazed! Read further.
Sponsored Links
Consider a scenario where you need to make a ‘business decision’ in your program, to make a decision you need data. To get data you need to call a method. However the method name is not known at design time. It will only be known at run time.
In this case you need to pass the unknown method as a parameter. The method that you are passing in is known as a Callback function. Call back functions are pointers to methods.
.NET implements the concept of function pointers using delegates.
* Delegate wraps a method. Calling delegate results in calling the method.
* Delegate is a type of object very similar to classes.
* Delegate gives a name to a method signature.
Where are Delegates used?
The most common example of using delegates is in events.
You define a method that contains code for performing various tasks when an event (such as a mouse click) takes place.
This method needs to be invoked by the runtime when the event occurs. Hence this method, that you defined, is passed as a parameter to a delegate.
Source from
http://www.exforsys.com/tutorials/csharp/delegates-in-csharp.html
C# Multicast Delegates - A Practical Example
Location: BlogsNetSplore's Blog
Posted by: Joe Rattz 11/23/2006 4:04:44 AM
The C# language has a feature known as the multicast delegate. Any delegate that has a void return type, is a multicast delegate. A multicast delegate can be assigned and invoke multiple methods.
You may have seen hints of this in your code. For example, if you are doing ASP.NET development and have ever looked at a page's InitializeComponent() method, you may have noticed a statement like this:
this.SearchButton.Click += new System.EventHandler(this.SearchButton_Click);
Notice the += in that statement. That is a clue. You could add another event handler if you wanted, and it would get called as well. For example, let's say you wanted to also call a method named NotifyStatistics every time the Search button was clicked. Then your code could be:
this.SearchButton.Click += new System.EventHandler(this.SearchButton_Click);
this.SearchButton.Click += new System.EventHandler(this.NotifyStatistics);
Every time the user clicks the Search button, first SearchButton_Click() is called, followed by NotifyStatistics(). The event handlers are called in the order they are added. Likewise, using -=, an event handler can be removed.
Now, you may be asking, why not just add whatever code is in the NotifyStatistics method to the SearchButton_Click method?
source from
http://www.netsplore.com/PublicPortal/blog.aspx?EntryID=9
Difference Between Delegates and Interfaces
You use delegates when you think of a .NET code that takes callback parameters, which look a lot like strongly typed method pointers in C++. You may not think that you can implement a callback parameter as an interface. Interfaces and delegates have a common key property of allowing you to call a method with the right prototype without knowing which object implements the method, which instance is bound to the call, or the name of the method you're calling.
1. Interface calls are faster than delegate calls. An interface reference is a reference to an instance of an object which implements the interface. An interface call is not that different from an ordinary virtual call to a method. A delegate reference, on the other hand, is a reference to a list of method pointers. While invoking a delegate looks like you're making an indirect call through a method pointer, it's actually a subroutine call that walks the list of method pointers. The overhead involved in making the call and walking the list means that delegate invocation can be two or three times slower than calling a method through an interface reference.
2. Interfaces are also a bit more general than are delegates. A single interface reference gives you access to all the methods of the interface. You can also check if the interface is implemented by this object type, or if the object also implements that other interface. If it does, you can cast the interface reference to an instance reference, or to a reference to another interface. Conversely, you can not go from a delegate to the instances it will call or to any other methods those instances may support.
However, don't conclude from this that you should always implement callbacks via interfaces, not delegates. One key difference between delegates and interfaces is that you can create a delegate to any method with the right prototype.
Overriding….
http://stackoverflow.com/questions/392721/difference-between-shadowing-and-overriding-in-c
http://www.noupe.com/tutorial/51-best-of-jquery-tutorials-and-examples.html
http://www.tutorialspoint.com/javascript/javascript_builtin_functions.htm
Most programmers are used to passing data in methods as input and output parameters.
Imagine a scenario where you wish to pass methods around to other methods instead of data. Amazed! Read further.
Sponsored Links
Consider a scenario where you need to make a ‘business decision’ in your program, to make a decision you need data. To get data you need to call a method. However the method name is not known at design time. It will only be known at run time.
In this case you need to pass the unknown method as a parameter. The method that you are passing in is known as a Callback function. Call back functions are pointers to methods.
.NET implements the concept of function pointers using delegates.
* Delegate wraps a method. Calling delegate results in calling the method.
* Delegate is a type of object very similar to classes.
* Delegate gives a name to a method signature.
Where are Delegates used?
The most common example of using delegates is in events.
You define a method that contains code for performing various tasks when an event (such as a mouse click) takes place.
This method needs to be invoked by the runtime when the event occurs. Hence this method, that you defined, is passed as a parameter to a delegate.
Source from
http://www.exforsys.com/tutorials/csharp/delegates-in-csharp.html
C# Multicast Delegates - A Practical Example
Location: BlogsNetSplore's Blog
Posted by: Joe Rattz 11/23/2006 4:04:44 AM
The C# language has a feature known as the multicast delegate. Any delegate that has a void return type, is a multicast delegate. A multicast delegate can be assigned and invoke multiple methods.
You may have seen hints of this in your code. For example, if you are doing ASP.NET development and have ever looked at a page's InitializeComponent() method, you may have noticed a statement like this:
this.SearchButton.Click += new System.EventHandler(this.SearchButton_Click);
Notice the += in that statement. That is a clue. You could add another event handler if you wanted, and it would get called as well. For example, let's say you wanted to also call a method named NotifyStatistics every time the Search button was clicked. Then your code could be:
this.SearchButton.Click += new System.EventHandler(this.SearchButton_Click);
this.SearchButton.Click += new System.EventHandler(this.NotifyStatistics);
Every time the user clicks the Search button, first SearchButton_Click() is called, followed by NotifyStatistics(). The event handlers are called in the order they are added. Likewise, using -=, an event handler can be removed.
Now, you may be asking, why not just add whatever code is in the NotifyStatistics method to the SearchButton_Click method?
source from
http://www.netsplore.com/PublicPortal/blog.aspx?EntryID=9
Difference Between Delegates and Interfaces
You use delegates when you think of a .NET code that takes callback parameters, which look a lot like strongly typed method pointers in C++. You may not think that you can implement a callback parameter as an interface. Interfaces and delegates have a common key property of allowing you to call a method with the right prototype without knowing which object implements the method, which instance is bound to the call, or the name of the method you're calling.
1. Interface calls are faster than delegate calls. An interface reference is a reference to an instance of an object which implements the interface. An interface call is not that different from an ordinary virtual call to a method. A delegate reference, on the other hand, is a reference to a list of method pointers. While invoking a delegate looks like you're making an indirect call through a method pointer, it's actually a subroutine call that walks the list of method pointers. The overhead involved in making the call and walking the list means that delegate invocation can be two or three times slower than calling a method through an interface reference.
2. Interfaces are also a bit more general than are delegates. A single interface reference gives you access to all the methods of the interface. You can also check if the interface is implemented by this object type, or if the object also implements that other interface. If it does, you can cast the interface reference to an instance reference, or to a reference to another interface. Conversely, you can not go from a delegate to the instances it will call or to any other methods those instances may support.
However, don't conclude from this that you should always implement callbacks via interfaces, not delegates. One key difference between delegates and interfaces is that you can create a delegate to any method with the right prototype.
Overriding….
http://stackoverflow.com/questions/392721/difference-between-shadowing-and-overriding-in-c
http://www.noupe.com/tutorial/51-best-of-jquery-tutorials-and-examples.html
http://www.tutorialspoint.com/javascript/javascript_builtin_functions.htm
Subscribe to:
Posts (Atom)
