Dynamically set control visibility inside ItemTemplate’s of GridView using Bind Expression September 1, 2011
Posted by Abhijit Jana in .NET 4.0, ASP.NET, C#.Tags: ASP.Net, Beginners, Binding, BindingExpression, GridView, ItemTemplates
8 comments
GridView TemplateField allow us to specify custom controls, multiple fields and Html using a custom template. TemplateField allows us to define a completely customized template for GridView Column. We can bind the data with in template control using binding expression. ASP.NET provides number of ways to take control over the template control. In this post I am going to discuss how we can set template control visibility based on certain condition which depends on the data source data. For example, imagine you have a link button within template field. You want to set visibility if that control based on the some value of your data source.
31 Tips on ASP.NET, C#, WPF , MEF, MVC, Visual Studio – August 2011 Links August 31, 2011
Posted by Abhijit Jana in .NET 4.0, ASP.NET 4.0, C#, Tips and Tricks.Tags: dailydotnettips, Tips & Tricks
1 comment so far
Daily .NET Tips is aiming to sharing useful coding tips and tricks for .NET Developers. This site completely design for sharing Tips and Tricks, useful Code Snippet which anyone use in daily development work and targeted anything related with .NET. This month we have wide range of tips including Threading, MEF, WPF and MVC. In this post I am quickly listing down all the tips which are published over the month August 2011
Use “Obsolete” attributes to indicate Obsolete Methods September 3, 2010
Posted by Abhijit Jana in ASP.NET, C#, General, Tips and Tricks, Visual Studio.Tags: Beginners, codeproject, How To, Obsolete, Tips and Tricks, Visual Studio
10 comments
In this post I have explained how you can use Obsolete attributes to mark some methods which are not no longer in used or may be remove in future release of the class. During the development cycle we may need to change the name or declaration of certain methods which may be using by some other developers. In this case if you changed the name or declaration of that method, application may crash in different point of times as it’s being used by other developer in the application. In this case you can use System.ObsoleteAttributes class to generate compiler warning and indicate the method as Obsolete.
How to pass ASP.NET server side array to client side and binding them with Html element? July 5, 2010
Posted by Abhijit Jana in ASP.NET, C#.Tags: ASP.Net, codeproject, javscript
11 comments
This is a very often requirement for an ASP.NET Developer to pass a sever side array to client side and access them through java Script. There are several ways to do that. But here I am describing one of the simplest steps to pass server side array to client side. In this blog post you will get to know two things, first one is the how to pass the array from server side to client side and second one is the how to bind that array to an empty “html dropdown” list.
Well, the easiest way to pass the server side array to a client side is using “RegisterArrayDeclaration” . RegisterArrayDeclaration method registers a javascript array with the System.Web.UI.Page Object. As the array object registered with the “Page” object so we can access it from javascript easily. RegisterArrayDeclaration takes array name and value of the array element as argument.
In below example, I have registered one array with name of “Skills”.
protected void Page_Load(object sender, EventArgs e)
{
// Register List of Languages
Page.ClientScript.RegisterArrayDeclaration("Skills", "'C#'");
Page.ClientScript.RegisterArrayDeclaration("Skills", "'VB.NET'");
Page.ClientScript.RegisterArrayDeclaration("Skills", "'C'");
Page.ClientScript.RegisterArrayDeclaration("Skills", "'C++'");
}
Now, what above declaration does? This is nothing but a declaration of a java script array like,
Var Skills = new Array('C#', 'VB.NET','C','C++');
These “Skills” array is now only a JavaScript array which is easily accessible by client side code. Now Let’s have a look how to access them and how to bind them in a dropdown list. (more…)
My New Article : Exploring Caching : Using Caching Application Enterprise Library 4.1 January 10, 2010
Posted by Abhijit Jana in .NET 4.0, ASP.NET, C#, Enterprise Library 4.1, Visual Studio 2010.3 comments
Enterprise Library caching application Block provides ready to use Caching Framework. This can be used in various application like
* ASP.NET Web application
* Windows Forms
* Console
* Windows Service
* Enterprise Services
* Web service
Implementing caching using Caching Application Block improve the performance of application as well as reduces the development time and cost. This Application blocks provides all kinds of function like adding, removing, managing expiration of cache.
As caching application block is predefined set of code and that are defined in a framework for that we need install Enterprise Library 4.1 First then we need to add some reference in to our application. These are Microsoft.Practices.EnterpriseLibrary.Caching.dll and Microsoft.Practices.EnterpriseLibrary.common.dll.
I have published one complete article on Codeproject.com which describe how to use Enterprise Caching Application Block 4.1 . Here is my complete article
Exploring Caching : Using Caching Application Enterprise Library 4.1
Please provide your valuable suggestion and feedback to improve my articles.
Thank you !
My New Article : DotNetNuke : User Creation and Role Assignment : For Absolute Beginners! September 26, 2009
Posted by Abhijit Jana in ASP.NET, C#.add a comment
Today, I have published another article on DotNetNuke (DNN). I am working with DNN for last 1 year and having a good experience on DNN. This article is about to create user and roles in DNN. This will really helpful to all the DNN Beginners. If you really interested, Here is my complete article DotNetNuke: User Creation and Role Assignment : For Absolute Beginners!
Please provide your feedback and suggestion for improve this article. Thanks
My New Article : Test Your ASP.NET WebServices using SOAP UI August 9, 2009
Posted by Abhijit Jana in ASP.NET, C#, My Articles, Web Services.2 comments
Today I have published another article on Web Service Testing- Using SOAP UI. This is very important to test our web service before we moved it to production. Soap UI is one of the best tool for test any SOAP Request and Response. If have described the basick overview of that tool so that any one can start from scratch. If you are really intereseted, then please read my article complete here, Test You Web Service Using Soap UI
Please give your suggestion and feedback .
My New Article : Debug your web application Hosted on Remote IIS July 15, 2009
Posted by Abhijit Jana in ASP.NET, C#, My Articles.11 comments
Lastnight I have published another article on debugging of ASP.NET article which hosted on Remote IIS Server. Its all about the how to msvsmon.exe and its configuration. If you really interesed, Here is my complete article Remote IIS Debugging : Debug your ASP.NET Application which is hosted on “Remote IIS Server”
Please give your valuable suggestion and feedback.
XSL Transformation : Rendering XML using XSL – HTML Output July 7, 2009
Posted by Abhijit Jana in ASP.NET, C#, My Articles.9 comments
Overview
Some times we need to display the XML data in our web application in specific format. XSLT provides the ability to display the XML document in some specific format like HTML, PDF etc. We can select a a XML file or a portion of XML File and using XSL Transformation we can display in some specific format.
An XSL transformation need an XML document to transform and an XSL style sheet describing how the transformation will take place. An XSLT engine then transforms the XML document via the XSL style sheet and will produce the output in the format specified by the style sheet.
How to Implement ?
1. Create Data Base :
Rather than reading the data from xml, I have read the data from database. First of all I have create an DB Student with table name “StudentDetails” . Table contain some dummy data like,
2. Add XSL File
Before, reading the data from database, we have to create the XSL file, We can add XSL file by just right click on the project > Add New Item >Select XSLT File
3. Desing XSL
Now, Designing XSL is one of the important task, and there are many things that related with XSL . In my case, this is very simple XSL, but if you need to learn in details, I will suggest you to read from W3School. First of all have a look into the XML data which I have got from the dataset.
And based on that we need to desing the XSL File. Below is the StudentDetails XSL
Now, have a look into the code, Read the data from database and put it into dataset. We can easily get the XML from dataset using. Below code is used to read data from database GetHtml function actually doing the job. Its taking XSL Stylesheet and XML data as parameter and returning the html output </span>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<table width="100%" align="center" cellpadding="0" cellspacing="0" border="1"
style="background-color:#123456;font-family:verdana;font-size:10pt;border:1">
<tr>
<td width="10%" align="left" >
Roll</td>
<td width="70%" align="left">
Name</td>
<td width="20%" align="left">
Address</td>
</tr>
</table>
<xsl:for-each select="Students/Table">
<table width="100%" align="center" cellpadding="0" cellspacing="0" border="1"
style="font-family:verdana;font-size:10pt;border:1">
<tr >
<td width="10%" align="left" >
<xsl:value-of select="Roll"/></td>
<td width="70%" align="left" >
<xsl:value-of select="Name"/></td>
<td width="20%" align="left" >
<xsl:value-of select="Address"/></td>
</tr>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<span style="font-family: Verdana; font-size: x-small;">
string XMLString=ds.GetXml();
public string strstudentDetails = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
string _strConnectionString = "Data Source=.\\sqlexpress;Initial Catalog=Student;Integrated Security=True";
string _strquery = "select * from studentDetails";
SqlConnection con = new SqlConnection(_strConnectionString);
DataSet ds = new DataSet("Students");
SqlDataAdapter da = new SqlDataAdapter(_strquery, con);
da.Fill(ds);
//Get the XML From DataSet
string strXML = ds.GetXml();
strstudentDetails=GetHtml(Server.MapPath("~/xsl/studentDetails.xsl"), strXML);
}
Now for displaying the result, we have to put following line in the aspx page, and the output like, Hope this will help you to move ahead with XSL Transformation. Thankyou
/// <summary>
/// Get HTML From XML and XSL
/// </summary>
///
<param name="xsltPath">XSL File Path</param>
///
<param name="xml">XML String</param>
/// <returns>HTML Output</returns>
public static string GetHtml(string xsltPath, string xml)
{
MemoryStream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(xml));
XPathDocument document = new XPathDocument(stream);
StringWriter writer = new StringWriter();
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(xsltPath);
transform.Transform(document, null, writer);
return writer.ToString();
}
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Student Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table >
<tr>
<td>
<b>Student Info : Displying using XSL Rendering</b></td>
</tr>
<tr>
<td>
<%= strstudentDetails %></td>
</tr>
</table>
</div>
</form>
</body>
</html>
My Recent Article :Debug Your ASP.NET Application that Hosted on IIS : Process Attach and Identify which process to attach June 11, 2009
Posted by Abhijit Jana in ASP.NET, C#, My Articles.8 comments
Ahh… After a long time, I have a published an article on Codeproject.
This article describe how to debug a web application which is hosted on IIS. It also describe how to select a particular process to attach with your application when multiple worker process are running. Please read details over here and give your suggestions and feedback
Thank you.
First Prize winner in Competition “Best ASP.NET article of January 2009″ March 25, 2009
Posted by Abhijit Jana in ASP.NET, C#, My Articles, SQL Server 2005.2 comments
I have won the first prize for my “Exploring Session in ASP.NET” article in the month of January . Thanks to all for voting.













