Tag | GridView Posts

I just wrote a small article which demonstrates how you can authenticate a user against different sources. These sources include MemberShip details tables, Custom Database and XML file. Check out the article at the following link: Authenticating Users Using Login Control powered by IMHO 1.3 ...
Sometimes we need to get some id from the database table and use that id to generate the link. Something like this: SomePage.aspx?id=34 You can easily do this by using the following code: <ItemTemplate><asp... ID="myHyperlink" Text='<%# Eval("CategoryName") %>' NavigateUrl='<%# FormatUrl( (int) Eval("CategoryID")) %>' runat="server">[myHyperl... </ItemTemplate>And here is the FormatUrl method: protected string FormatUrl(int categoryID) { ...
This error comes when you are exporting the GridView control in the Visual Studio.NET 2005 BETA Versions. I am using the released version so I never got this error. Anyway, you can solve this error but the trick is very dirty. You have to turn the eventValidation off in order for this to work. You can do this in the web.config file but in this case the eventValidation will be turned off for all the pages. <pages enableEventValidation ="false" ></pages> or you can do this in the Page directive ...
Here is the complete code to Export GridView to Excel: using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;u... System.Web.UI.WebControls.W... System.Web.UI.HtmlControls;... System.Data.SqlClient; public partial class ExportGridView : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { GridView1.DataSource = BindData(); ...
Last week my manager come to me and ask me to develop a prototype for our new project next year. So the deadline is must be before next year. Which me not less than 10 days. The problem is, the system that need to develop must use all the new features in VS 2005. Thats sounds good for me :). But why is it a problem. Because it is a web based system, after a long time developing in Windows Forms I found that it is hard for me to rapidly develop in asp.net. so shame on myself. I have left the web behind ...
Someone once said that the best way to learn the new technology is to build several application that are implemented in it. I will be starting to make a small application about How to create a simple TODO Task Application. This application will be implemented in ASP.NET 2.0 using C# and SQL SERVER 2000. I will cover the whole process of this application in the form of articles on my website www.gridviewguy.com. This will be a small series of articles. I hope you like this small series of articles. ...
I got the notification yesterday afternoon about the release of the Infragistics NetAdvantage 2005 Volume 3 for Visual Studio 2005 (CLR 2.0). Of course the servers were taxed, so I couldn't download it until later in the evening. I got it installed today and took a quick look at some of the Windows Forms samples (I'm not involved with web development at this point). There's nothing really exciting that I see -- that is above and beyond the CLR 1.0 release of Volume 3. The release notes indicates ...
Couple of months ago I wrote an article on how to implement Google Suggest Functionality using AJAX.NET Library. I managed to improved it little bit more and now you can use the cursor keys to select the items from the listed suggestions. I will be writing an article about this shortly and will upload it to my website www.gridviewguy.com. One thing that I was not able to figure out was how to change the row colors of the div rows since I am using plain DIV with no element inside it. Anyway, if any ...
I created a very simple Screen Scrape Button Control which you can use to export the html of a particular page to a text file. I have also made a property Expression which you can use to set any regular expression and hence narrow your exportation task. This control will be available for free. Please check back the website www.gridviewguy.com in couple of days where you will find the link to download the control. Here is a the part of the code to dynamically load the control: ScreenScrapButton sButton ...
Today I sold my first Export Button Control to a gentleman :). I am quite happy about it. If you are not familier what I am talking about then here is a brief introduction about the Export Button. Export Button: Export Button will allow you to export your DataGrid control to Excel, Text, XML or Word format file. All you need to do is to provide the ControlID to the Export Button and thats it. You can view the live demo of Export Button at Export Button Live Demo. I hope you like it :) powered by ...
| From: "Juan Ignacio Gelos"| Subject: DataGridView| Date: Mon, 10 Jan 2005 14:07:46 -0300| Lines: 11| | Hi,| | Any simple, non-overcomplicated way of preventing the focus-rectangle| from being drawn in cells? By the way, and in case this wasnt corrected in| the latest builds, this should be the default behavior when SelectionMode =| FullRowSelect.| | Thanks,| Juan| In Beta1 build you handle the RowPrePaint event and set the CellsPaintFocus to false. In Beta2 builds you can leave it the same or handle ...
Last week, I purchased the new Wrox Publisher ASP.NET book called Professional ASP.NET 2.0 by Bill Evjen, Scott Hanselman, Farhan Muhammad, S. Srinivasa Sivakumar, Devin Rader. The book was mentioned on Brian Goldfarb’s blog. Brian works with ASP.NET at Microsoft Corporation and he’s bright and super energetic. I’ve heard him talk on a couple of occasions and more recently heard him on a webcast that he did on stage with Steve Balmer at the VS Studio event in San Francisco. A couple ...
Sometime back I should how to attach the DHTML ToolTip with the DataGrid control . This time the same concept of the DHTML ToolTip but now I am using a Calendar Control. Check out the image below: Yeah, looks kinda sweet. This will be a good way to display the summary of the items or data which are dependent on dates. Check out gridviewguy.com regularly since I will be uploading an article about this very soon! powered by IMHO ...
Okay, finally the Export Button is out. Check out the link below and give it a try. http://gridviewguy.com/Arti... powered by IMHO ...
I am pretty sure this Export Button Custom Server Control is going to get me FAIL in my Exam on Tuesday. I am very exicited about this custom control. Here are some of the features of Export Button Control: Export to multiple Formats: The control allows you to export your data to multiple formats. Which include Excel, Text, XML and Word documents. Design View functionality: Simply drag and drop the control from the toolbox and right click to assign the properties. Properties: Here are some of the ...
I was looking for some good FAQ's posted on Winforms 2.0 when I hit upon this page at the WindowsForms.net site. The DataGridView faq is probably the most comprehensive I have found so far on the net. DataGridView FAQ ratingA - GoodB - Very GoodC - ExcellentD - None of the above (Human Error: Could not find a word desribing above excellent) My Answer: d ...
Well, I was getting too bored so I thought of implementing the Export Button Server Control. Now you can simply drag and drop the export button on the form and give it the id of the Datagrid or the TextBox control that you want to export. After supplying the id of the control simply run the application and push the button and it will export the contents of the DataGrid to the Excel file. Ohh yeah you can also provide the name of the file name using FileName property. Check out this link to download ...
People please stop passing DataReader to the presentation layer. If you want to use datareader object then use it to fill a custom collection and then pass the custom collection to the presentation layer where it can be bind to a control or whatever. Check out this code: public static SqlDataReader GetCategories() { string connectionString = @"Server=localhost;Database... SqlConnection myConnection = new SqlConnection(connectionStr... SqlCommand myCommand = new ...
Okay, I was getting lot of emails about how to pass the data from the child window to the parent window. In the code below I pass the DataTable from the child window to the parent window. The child window has a datagrid and you select the items from the datagrid and those items are passed back to the parent window. Parent Window: protected void Page_Load(object sender, EventArgs e) { if (Session["SelectedItems"] != null) { GridView1.DataSource = (DataTable)Session["Selecte... GridView1.DataBind(); ...
Here is a little tip from Scott Guthrie. In Visual Studio.NET 2005 if you select anything in the design view like buttons, textboxes, gridview and go back to the html view then whatever you selected will be reflected in the html view. Its pretty cool check it out. powered by IMHO ...
Pretty simple idea to change the row color of the GridView control on the onmouseover event. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmou... "this.style.backgroundColor... // This will be the back ground color of the GridView Control e.Row.Attributes.Add("onmou... "this.style.backgroundColor... } } ...
Some developer emailed me asking that how can he extract the selected value from a DropDownList which is inside the GridView control. Over here I will present two ways to extract the values. The first way loops through the GridView control and gets all the values from all the rows (Rows that contains the DropDownList) and binds them to the DataTable object and later to the another GridView control. Second method simply uses the feature of the select column and displays the DropDownList value from ...
Session data is very important for all applications. Session enable the application to recognize the user by using credentials. Sometimes we need to transfer the Session from one application to another. If you are working with In-Proc session mode than you cannot share the session in different applications. However there is a small way you can use to transfer the session from one application to another in the In-Proc session mode. Read Maintaining Session Between Two Applications ...
The code below creates a GridView control that have a hyperlink column which sends the ID to other page: Here is the simple code which you can use: <asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" CellSpacing="1" GridLines="None" AutoGenerateColumns="False"... <FooterStyle BackColor="#C6C3C6" ForeColor="Black" /> <RowStyle BackColor="#DEDFDE" ForeColor="Black" /> <PagerStyle BackColor="#C6C3C6" ...
A new oddity seems to have cropped up after moving our projects from asp v2.0 b2 to asp v2.0 rc1... My gridview's have boundfield's with the DataFormatString set to {0:C}. <asp:gridview runat="server" id="GridView1" width="100%" OnRowDataBound="GridView1_R... autogeneratecolumns="False" cellpadding="6" DataKeyNames="ShoppingCartD... DataSourceID="SqlDataSource1" ><EmptyDataTemplate&g... are no items in the cart.</EmptyDataTemplate... /><Columns><asp... ...
Hi Everyone, First of all I like to apologize for my absence and not writing any new articles for couple of days. Actually my exams, assignments and all sort of boring stuff is due these days. I will try my best to write few good articles during the weekened. Please view the articles at www.gridviewguy.com. Thanks, AzamSharp powered by IMHO ...
Okay I am playing around with Visual Studio.NET 2005 BETA II. If you need to display data in the GridView object then you can simply open the Server Explorer and drag and drop the table which you like to be displayed on the screen. When the table is dropped on the webform it will create a GridView object automatically and displays the contents of the table. powered by IMHO ...
We’ll it’s been awhile, but I’m back to the ‘art’ of programming in VB.Net / ASP.Net.Today I was trying to figure out how to set data in a GridView to uppercase. Well, not finding any help out there, I decided to forge my own path. Below is what I’ve discovered.The first step is to create a function that converts the cells contents into uppercase...I want to convert the data in the 9th cell (column) – remember the grid cells are zero based, so visually this ...
Sometime ago I wrote an article about Exporting Datagrid to Excel, Word and Text Files. Sometimes we need to export Dataset to xml file. This is pretty simple as all you need is a literal control which will render the data to the output stream. Check out the code below: SqlConnection myConnection = new SqlConnection(ConnectionStr... SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM Categories", myConnection); DataSet ds = new DataSet(); ad.Fill(ds, "Categories"); Literal l = new Literal(); ...
Where do I start learning .NET? This is perhaps the most asked question on www.asp.net forums. With the arrival of ASP.NET 2.0 I think it will be a better idea to start learning 2.0 instead of 1.x. The reason I am saying this is that 2.0 is quite different from 1.x. Here is some basic stuff which might help a newbie to start .NET. C++ and Java developers: If you are coming from the C++ or java background your choice should be C# since its pretty much the same syntax and you can quickly pick it up. ...
No more looping through all the rows and finding which one is the footer row. ASP.NET 2.0 GridView control contains the property FooterRow which returns the footer row. Check out the following code where I get the value out of the TextBox which are in the footer row of the GridView control. string firstName = string.Empty; string lastName = String.Empty; // Gets the footer row directly Cool right! GridViewRow row = GridView1.FooterRow; firstName = ((TextBox)row.FindControl("... lastName ...
Everyday I receive several emails from developers asking questions about my articles. To reply every single email is pretty hard so I decided why not to create a question posting forum and in this way the answer will be visible to more users. The forum is pretty simple just type the question and it will show under the particular article. You can check out the article with the question at this link (scroll down at the bottom). powered by IMHO ...
Some developer emailed me and asked that how can he extract TextBox text when the TextBox is inside the GridView control. So, I implemented few lines of code to access DropDownList, TextBox and also ListBox which are inside the GridView control. First you need to populate the DropDownList and ListBox object. // This method also Populates the ListBox should be called PopulateDropDownAndListBox() :) public DataSet BindDropDownList() { SqlConnection myConnection = new SqlConnection(GetConnection... ...
I spent my sunday learning about Code Generation using XSLT. Lot of times we write repetitive code. This mainly includes creating entity classes. With code generation you can develop a template which writes code for you. In other way Code Generation means code that writes code . I wrote a very simple template which is used to make entity classes. Its not perfect design but you can get idea how it works. The xml file acts as the container where you tell the code generator what fields, methods ,properties ...
I am pretty sure everyone knows about the JavaScript confirmation window if not you can look at the image below: Anyway, sometimes we need to capture "ok" as well as "Cancel". "Ok" is easy to catch since the server side button click will take place if you click "ok". Catching "cancel" is kinda hard since cancel is only handled on the client side. What if you want to do something when the cancel button is clicked. You can use AJAX to solve this problem. Here is a simple example. Below are the two ...
I wrote an article on Enterprise Library Caching Block in which I described the use of Caching Block. Few days ago I received an email from a developer asking that what are the advantages of using Enterprise Library Caching Block over the standard caching. If we talk about performance than they are pretty much the same. Actually I will be inclined towards the standard caching since Enterprise Library calls the standard caching under the hood. The main advantage of using the EL Caching is it's easier ...
Last night I got my dishes wet by using AJAX. Apart from that I used the real AJAX which stands for (Asyncronous JavaScript And XML) makes the server side calls without using POSTBACKS pretty neat right! You can check out my article AJAX IN ACTION in which I explained that how you can refresh the datagrid without doing a POSTBACK. Check it out, happy coding!
Hi, This is Mohammad Azam. I will be graduating in December 2005 from University of Houston with Bachelors in Computer Science Degree. Apart from my contributions on asp.net forums I am also founder and auther of www.gridviewguy.com. Currently I am looking for a full time position as an Asp.net, C# developer. Please view my resume at www.azamsharp.net. Thanking you, Mohammad Azam
There is a lot of confusion in developers that when Session_End event is fired. I wrote a small article on this issue. Here is few lines from the article: Session End event is fired only in the In-Proc Session mode at the end of the request in which Session.Abandon() is called OR when the Session time expires. Session End will not be fired when you close the browser. Let's make a small test in the Global.asax file so that we will know that Session.Abandon is being called. Check out the complete article ...
I just read Bill Evjen's Learn ASP.NET Page, and it has a lot of good information you should check out. For some reason the comments on his page were not working. I couldn't get anything to post. So, here is a quick blast of items that I have stored in Yahoo! MyWeb related to .NET 2.0 Books There are not a lot of books out yet, but if you are familiar with ASP.NET already, check out ASP.NET 2.0: A Developer's Notebook. I leave it sitting on my Safari Bookshelf. They also publish a Visual Basic and ...
Sometimes it is very useful to do a postback on the parent window from the child window. As complicated it sounds in reality its very simple. This can be easily achieved by using JavaScript. Take a look at my article.
I was assigned a task at my workplace to write small piece of code that detects PopUp Blockers. This was easily accomplished using JavaScript. You can view the complete article at Detecting PopUp Blockers
DHTML is cool and mixing it with Asp.net is even cooler. Although I never wrote any DHTML scripts but I have mixed it with Asp.net to create some neat effects. In this article we will mix DHTML and Asp.net to create a tool tip effect. http://gridviewguy.com/Arti... ...
This is something I've been looking forward to for a while. CFML style pages that can access .NET Components directly (without using COM interop, and without actually running in a Java runtime) I remember back in the day of the start of my “professional” career back in 1998. College was boring me, the Internet was hot, and money was flowing like wine at a French dinner table. I busted out of college within the next month, and started writing a B2B app called “Floraplex” that ...
I was having trouble exporting Datagrid to Excel because it contained paging and sorting links. If you try to export with linkbuttons a runtime error will be thrown. I found this cool article which resolves this problem. Check it out Exporting Datagrid to Excel For Datagrid formatting issues view my article: Exporting Datagrid to Excel ...
I just wrote this small SPROC which builds the list of email address and separates them with a comma. CREATE PROCEDURE [usp_GetEmailList] @EmailList nvarchar(200) OUTPUT AS DECLARE @Email nvarchar(50) --DECLARE @EmailList nvarchar(200) SET @EmailList = '' DECLARE Email_Cursor CURSOR FOR SELECT Email FROM tblPerson OPEN Email_Cursor FETCH NEXT FROM Email_Cursor WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM Email_Cursor INTO @Email SET @EmailList = @EmailList + @Email + ',' END SET @EmailList = SUBSTRING(@EmailList,0,LEN(... ...
I had posted a while back about a few things about ASP.Net that really gets on my nerves: DataGrids (and GridViews to much of the same extent), ViewState bloat, poor radio button support, and so on. Mike Roberts (of Cruise Control .NET) is saying Goodbye to Web Forms altogether. I think this has the potential to become a trend. ASP.Net in some ways is just old news... loosely based on JSP's, ASP.Net feels like bloatware now. We had an interesting first version. But the problems are many, as summarized ...
I have this requirement for the Master-Detail page with GridView/DetailView: By default, the GridView should have the first row seleted, and DetailView showing information for that row. So I have a GridView control gdvScheduleList and a DetailView control dtvScheduleDetail. The data source for ScheduleDetail is called SqlDataSourceScheduleDetail. The parameter of SqlDataSourceScheduleDetail is “ScheduleId“. Here is the even handler for the GridView gdvScheduleList's DataBound event, which ...
I wrote an article about Exporting DataGrid to Excel which can be viewed at www.GridViewGuy.com. One question that is asked again and again was how to export the Datagrid which has the link buttons in it. If you try to export a Datagrid with link buttons inside it than it will throw an exception saying "LinkButton server control must be inside the Form tags with runat = server". If you view the html source then you will see that the LinkButton is inside the form tags with runat = server. This error ...