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.
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.
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.
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.
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.
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.
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.
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 2) Now new window will open then select Web -> ASP.NET Web Appliction. Then rename it and click ok.
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 4) Then new window will be displayed. Then select the Generic Handler and rename it then click on Add–>
Step 5) Now open the Default.asp page in Design view and design the form as required using Button Tool from toolbox.
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)
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.
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.