ASP.NET DataGrid basic questions

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags , with 2 Comments on ASP.NET DataGrid basic questions
  1. What is datagrid? The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
  2. What’s the difference between the System.Web.UI.WebControls.DataGrid and System.Windows.Forms.DataGrid? The Web UI control does not inherently support master-detail data structures. As with other Web server controls, it does not support two-way data binding. If you want to update data, you must write code to do this yourself. You can only edit one row at a time. It does not inherently support sorting, although it raises events you can handle in order to sort the grid contents. You can bind the Web Forms DataGrid to any object that supports the IEnumerable interface. The Web Forms DataGrid control supports paging. It is easy to customize the appearance and layout of the Web Forms DataGrid control as compared to the Windows Forms one.
  3. How do you customize the column content inside the datagrid? If you want to customize the content of a column, make the column a template column. Template columns work like item templates in the DataList or Repeater control, except that you are defining the layout of a column rather than a row.
  4. How do you apply specific formatting to the data inside the cells? You cannot specify formatting for columns generated when the grid’s AutoGenerateColumns property is set to true, only for bound or template columns. To format, set the column’s DataFormatString property to a string-formatting expression suitable for the data type of the data you are formatting.
  5. How do you display an editable drop-down list? Displaying a drop-down list requires a template column in the grid. Typically, the ItemTemplate contains a control such as a data-bound Label control to show the current value of a field in the record. You then add a drop-down list to the EditItemTemplate. In Visual Studio, you can add a template column in the Property builder for the grid, and then use standard template editing to remove the default TextBox control from the EditItemTemplate and drag a DropDownList control into it instead. Alternatively, you can add the template column in HTML view. After you have created the template column with the drop-down list in it, there are two tasks. The first is to populate the list. The second is to preselect the appropriate item in the list “” for example, if a book’s genre is set to “fiction,” when the drop-down list displays, you often want “fiction” to be preselected.
  6. How do you check whether the row data has been changed? The definitive way to determine whether a row has been dirtied is to handle the changed event for the controls in a row. For example, if your grid row contains a TextBox control, you can respond to the control’s TextChanged event. Similarly, for check boxes, you can respond to a CheckedChanged event. In the handler for these events, you maintain a list of the rows to be updated. Generally, the best strategy is to track the primary keys of the affected rows. For example, you can maintain an ArrayList object that contains the primary keys of the rows to update.

You can find more questions on Datagrid at

Problems with parallel RFC servers in SAP

Author posted by Jitendra on Posted on under category Categories SAP and tagged as Tags , with 2 Comments on Problems with parallel RFC servers in SAP


Generally, the transaction RZ12  is used to create and edit RFC server groups for parallel execution of RFC enabled ABAP procedures and functions.  Using these parallel RFCs, we can reduce the overall execution time of long running jobs. 

Below are rare facts about the configuration of RFC servers in RZ12:

1. While configuring the resources which will be assigned to RFC servser groups; we will find that the “Determination of Resources” section allows to enter the preferences for the amount of system resources that will be allocated to the group.  Here, the problem is, the data entered  for these parameters is not RFC server group specific. Its actually application group wide, just like all the other profile parameters.  So, if we edit  RFC server group assignment row  and change its any field value, we change its corresponding application servers profile parameter and this change affects all RFCs running in the application server. This can be verified by opening any other RFC  server group.


2.  As we know the profile parameter  “rdisp/rfc_check”  enables the dispatcher check for asynchronous RFCs (checks whether the sufficient Dialogue work processes are available for processing the asynchronous RFC calls) and its default value is 2 but if we change it to 3 then the both Synchronous and Asychronous RFCs can be monitored. I would suggest to take a view of available Dialogue work processes and the documentation changing this value.

3.  If the parallel RFCs are being used to generate the periodic replacement list using transaction code EG88 then it calls the function EGTUR. In such a case, define the RFC group with name EGTUR and activate the same.

Handlers in ASP.NET

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags with 2 Comments on Handlers in ASP.NET

HTTP Handlers is a new technique presented in ASP.NET that was not present in the “Classic ASP”. HTTP Handlers are components that implement the System.Web.IHttpHandler interface. Unlike ASP.NET pages Handlers dont have HTML-markup file, no events and other supporting. All they have is a code-file (written in any .NET-compatible language) that writes some data to the server HTTP response.

ASP.NET handlers have “.ashx” file extension (unlike pages, that have “.aspx” file extension).

Handlers are considered to be more lightweight object than pages. That’s why they are used to serve dynamically-generated images, on-the-fly generated PDF-files and similar content to the web-browser.

One such scenario which may arise in any product is that if  I owe a site and I want to restrict the user from downloading a file if he/she is not logged in. But if the user (not logged) is allowed to see the url of the downloading file then he can just copy the url and paste it in another tab and he can easily download the file from there, i.e. my protection mechanism failed. Now here comes the use of handlers.

The handlers will restrict the user to even view  the url of the file to be downloaded unless he is logged in.

How to create the Handlers in ASP.NET in Visual Studio 8.0.

First step is to create new project-

Step 1) Open Visual Studio an Goto – File Menu ->New -> Project.

Step 1
Step 1

Step 2) Now new window will open then select  Web -> ASP.NET Web Appliction. Then rename it and click ok.

Step 2
Step 2

Step 3) Now we have to add the Handler (Don’t call it the page, its all different thing) Follow the steps to include the handler in the current project.

First Right Click on the Solution Explorer -> Add -> New Item ->

Step 3

Step 4) Then new window will be displayed. Then select the Generic Handler and rename it then click on Add–>


ASP.Net Handlers
Step 4

Step 5) Now open the Default.asp page in Design view and design the form as required using Button Tool from toolbox.

Step 5
Step 5

Step 6) Then write the following code on the click event of both the buttons in Default.aspx.cs page (Just double click on the buttons and it will automatically generate the block in source page)

protected void btnWoutSecurity0_Click(object sender, EventArgs e)
     Response.Redirect("LinkSecurty.ashx?isSecure = 1");
protected void btnWoutSecurity_Click(object sender, EventArgs e)
Step 7) Now open the Handler which we have created earlier i.e. LinkSecurity.aspx.cs  and write the following code–
public class LinkSecurity : IHttpHandler
     public void ProcessRequest(HttpContext context)
        if (context.Request["isSecure"] == null)
            context.Response.ContentType = "text/plain";
            context.Response.Write("You are not Logged In.... Please Login to access this page...");
            context.Response.ContentType = "image/png";
      public bool IsReusable
      {   get{return false;}

Upload Files in ASP.NET at Production server

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags , , , with Leave a comment on Upload Files in ASP.NET at Production server

In this article, i am going to demonstrate that how to upload the file in ASP.NET production server.

Most of the case, a developer created a code to upload the file and test it on his local machine. program runs smoothly, but as he forward the same code on production. He stuck in the file permission error as on the local he has the full permission whereas on development its not the case.

So i decided to write this tutorial for the beginners which will demonstrate lots of ASP.NET features.

First we need to create a folder in Server and share it with ASP.NET web server as described.

Right click on folder, select Web sharing tab and select the radio button “Share this folder”. One  window appear, give it alias name which will be used in coding.

After this, open Run box and type “inetmgr“. you will see that your web shared folder appears in the IIS.

Right click on folders property. one window will opened.

Select “Directory Security” tab then click on “Edit” button and then check “Anonymous access”. And because of this setting any body can access or download that file.

Now we are ready, to create a sample application which will demonstrate that how to upload the file and use it.

Create ASP.NET project in Visual Studio. Create a webpage with fileupload, hyperlink and button control.

<form id="form1" runat="server">
<asp:FileUpload ID="uploadFile" runat="server" /><br />
<asp:HyperLink ID="hypLink" runat="server" Visible="false" Target="_blank"></asp:HyperLink><br />
<asp:Button ID="btnUpload" Text="Upload" runat="server" OnClick="btnUpload_Click" />

In web.config add two keys.  One for actual folder location in which we are going to upload the files and other its alias name. we can also hard code that, but its good practice to make it configurable at any time because in near future we may want to change the location.


<add key="DemoAttachment" value="D:ShareDemoShare"></add>

<add key="DemoAttachmentVirtualPath" value="http://localhost/DemoShare/"></add>


In DemoAttachmentVirtualPath key, value should like “http://machinename/” + Alias folder name.

On click event of button, write below code:

string strPath = ConfigurationManager.AppSettings["DemoAttachment"];
uploadFile.SaveAs(strPath + System.IO.Path.GetFileName(uploadFile.FileName));
hypLink.Visible = true;
string VirtualPath = ConfigurationManager.AppSettings["DemoAttachmentVirtualPath"];
hypLink.Text = System.IO.Path.GetFileName(uploadFile.FileName);
hypLink.NavigateUrl = VirtualPath + uploadFile.FileName;
string strPath = ConfigurationManager.AppSettings["DemoAttachment"];

uploadFile.SaveAs(strPath + System.IO.Path.GetFileName(uploadFile.FileName));
hypLink.Visible = true;
string VirtualPath = ConfigurationManager.AppSettings["DemoAttachmentVirtualPath"];

hypLink.Text = System.IO.Path.GetFileName(uploadFile.FileName);

hypLink.NavigateUrl = VirtualPath + uploadFile.FileName;

The output will look like:

Download Source code

For the file size limitation, please visit this article :

cannot access a closed file – FileUpload in ASP.NET

Author posted by Jitendra on Posted on under category Categories ASP.NET and tagged as Tags , with 14 Comments on cannot access a closed file – FileUpload in ASP.NET

This was very interesting error, i got during development of file upload control in ASP.NET.

On my local system, every thing was just fine. but when i deployed my application on development server, my control was able to upload only small size files.

whenever i tried to upload large size file i got error “cannot access a closed file”

After going through MSDN i found that there is one new element added in ASP.NET 2.0 known as httpRuntime.

So i just added this new Tag in my web.config and every thing was right.

<httpRuntime  maxRequestLength="15360" requestLengthDiskThreshold="15360"/>

Note :

requestLengthDiskThreshold should not exceed the maxRequestLengthattribute.

To read more about this, please visit

XML Parsing Error: no element found

Author posted by Jitendra on Posted on under category Categories ASP.NET, Tech Tips and tagged as Tags , with 3 Comments on XML Parsing Error: no element found

Few Days ago, i found strange error like “XML Parsing Error: no element found“.

I was unable to find the exact root cause. Most of the times it happens if you are missing any closing tag in your ASPZ application. I checked my complete page and reconfirmed but error still persist.

somehow i found that ASP.NET treat the response of page as XML document and that’s why we receive XML Parsing Error: no element found error.

so explicitly i set the response type of my page as text/HTML. Response.ContentType = “text/HTML”.

And this line tells the ASPX that page is HTML, not XML.

WordPress Error: “missing A Temporary Folder.” After Uploading A File

Recently i got the error

“missing A Temporary Folder.” After Uploading A File

After digging lots of sites, i was unable to fix the problem.

Maximum sites offer solution like change php.ini etc. but changing configuration file and using shell command can be avoided by a simple trick.

Go to Plugins Tab in wordpress after Login.

Then click on Install, you will get below Screen.

click on Add New and search FCKEditor, Install It -> Activate.

And thus your problem solved.

you want to use that editor then use or Simply Deactivate but don’t uninstall.

Display author name in wordpress

Author posted by Jitendra on Posted on under category Categories Tech Tips and tagged as Tags , with 1 Comment on Display author name in wordpress

Look in the default theme’s index.php file for the proper template tag:

<code><?php the_author() ?></code>

and a good place to put it.

Display Author’s ‘Public’ Name

Displays the value in the user’s Display name publicly as field.

<p>This post was written by <?php the_author(); ?></p>

Get Author link

<p>Written by:
<?php echo get_the_author_link(); ?></p>

The Author’s Post

<p><?php the_author(); ?> has blogged <?php the_author_posts(); ?></pre>

The Author’s Post Link

<p>Other posts by <?php the_author_posts_link(); ?></p>

for more info check below URL

Install the OS on CD/DVD/Flash/Pen Drive

Author posted by Jitendra on Posted on under category Categories Tech Tips and tagged as Tags with 3 Comments on Install the OS on CD/DVD/Flash/Pen Drive

Pocket PC..

This article will show you how to install Windows XP on your CD/DVD/USB Pen drive/ Flash Drive/ thumb Drive.


1) Make sure that your system ( to be booted ) has about 500MB of free disk space!

2) Download the latest PE Builder version (self-installing package) and install it. Follow me to Download.
3) Start PE Builder (pebuilder.exe). When you start PE Builder for the first time it will ask if you agree with the license agreement.

4) Now PE Builder will ask to search for windows installation files. If you don’t have your windows XP setup/installation files on your system you must insert the original Microsoft WIN XP installation/setup CD . Click “yes” to start searching. PE Builder will now search all fixed- and CD-Rom drives for Windows installation files. This will take some time. When more than one valid location is found, a dialog will appear where you can select which location you want to use.

5) For making Bootable CD/DVD :

At the main PE Builder dialog, select the “Burn to CD/DVD” option. When you are using an erasable medium, make sure that the “AutoErase RW” option is enabled. The “burn using” option should be set to “StarBurn”. Select your CD writer device from the Device list.

Click on  “build” button. PE Builder will now ask you to create a BartPE directory, answer with “yes”.

The license for your Microsoft Windows XP product is shown. Read it and agree to it to continue.

PE Builder will now start building BartPE. This will take a few minutes.
You will see a lot of files getting copied and/or decompressed, the ISO image build and the data recorded to your CD/DVD writer.
If the data verify was correct and there where no errors reported you can boot the CD/DVD!

6)For making bootable Pen Drive:

Follow the above instructions and copy the files to the pen drive.

Enjoy your new preinstalled XP environment and use it for system Rescue Purposes…

Install OS From Your Flash/Pen Drive.

Author posted by Jitendra on Posted on under category Categories Tech Tips with Leave a comment on Install OS From Your Flash/Pen Drive.

Simple way to take your Desktop PC into your pocket via USB.

Most PC users have got very much habituated in installing Windows Operating system on their computer using the Windows Installation CD’s, but what if a user does not have a CD-ROM to read them and if he has a option of only using a Pen Drive? Then here is a small tutorial on how to get started and install a complete Operating System using the Pen Drive as Booting Medium and a drive to Store the Setup files.

First of all you need to make sure that you have got a Pen Drive with a total capacity of minimum 256Mb for the storage of the Setup Files though you can opt for the higher capacity drives and you need to make sure that the format of the Disk is correctly set before the installation process. Hence here we are going to use a tool  HP USB Disk Storage Format Tool for Formatting a USB Drive into the right File System which can be downloaded (Open Source Software- HP USB Disk Storage Format Tool – v2.1.8 ). Since most BIOS wont accept any drive and would only accept FAT File System you need to make sure that you have formatted the USB Flash Drive using this tool.

Follow this link To download the USB Format Software

Boot menu may vary.
Modal Boot Page

Next you need to get ready loading the OS files into the Flash Drive, following which you need to setup the Boot Device in the Advanced BIOS Features. The new version MotherBoards would have a option called “˜USB-HDD’ before the Hard Drive option and if you dont find this available you need to update your BIOS. If you find it, you need to change the order of booting and make sure that the USB-HDD is in the first option. Next save the BIOS settings and restart the computer.

There can be other names also listed for these Pen Drives which can be likely Removable Device, Removable Storage Device etc whom you need to select and make sure they are in the first position in the Boot Device Priority Section as that we do during booting xp from CD drive..


Nikhil Naoghare.