Tag | GridView Posts

Data-Bound Controls (1) - Templates In ASP.NET 2.0, the following controls are often used to do data binding. 1. GridView 2. DataList 3. Repeater 4. DetailsView 5. FormView GridView, DataList and Repeater are for displaying multiple records once, but DetailsView and FormView are for one record one time. In addition, to decide which control to use, we’d better understand what templates every control supports and what is the built-in layout for every control. Templates Templates are usually for defining ...
I have been working with the asp.net wizard control and have found it to work quite well. It's like having a workflow for some linked web pages. Each step has it's own "mini page". You can simply drag and drop controls from the toolbar onto the design area for the step. This includes the GridView and includes enabling edit within the Gridview control. Pretty slick. I recently ran into a problem though. I have a wizard control with 4 steps. Each step's design area contains several controls. I tried ...
I've used VB Master-Details Insert QuickStart sample in my application.It works relatively good(if ignore System.InvalidOperationExce... ObjectDataSource '...' could not find a non-generic method 'Update' that has parameters error).However to create a new record,you need to have DetailsView visible. However if the GridView is empty, DetailsView is not visible and user is uable to create the first record. I've added code to show DetailsView in DefaultMode="Insert" if no data was selected in the ...
I've hit the same problem again. I've already wrote 2 posts about the error "Exception Details: System.InvalidOperationExce... ObjectDataSource 'ods' could not find a non-generic method 'Update' that has parameters: ...." ( Editable GridView with ObjectDatasource and Update method parameters. and Some workaround for ObjectDataSource: could not find a non-generic method '...' .) And these posts are the most popular in my blog according to views statistics. Not because they are very useful - just ...
I'm sure you're all familiar with the GridView in asp.net 2.0. It's a great control, and coupled with the new (well, some time back they were... :)) data source controls it's big aid to rapid development. I've worked with it before, but I always used DataSets as data containers. Now, on a little project I'm working on, which uses DLinq, I resorted to custom objects. It worked rather good, until I got to the "save back to persistence" part. As you might know, the ObjectDataSource control supports ...
When using BoundFIelds and domain objects... BoundFields use some algo that can't traverse the object hierarchy. What am I talking about? Take for instance a Northwind database, with certain objects mapped to data tables: public class Customer{ public int CustomerId; public IList<Order> Orders;} When binding to a list of Orders in a gridview: int customerId = int.Parse(selCustomer.Selec... customersList = CustomerService.GetCustomer... ...
Today I experienced what I believe to be a classic asp.net dynamically loaded controls gotcha. Here's the scenario: I have one page with a panel on it like so: <asp:Panel ID="pnlGrid" runat="server"></asp:... ...plus I have a user control, GridControl.ascx, like so: <asp:GridView ID="gv" runat="server" AutoGenerateColumns="false" Width="100%"> <Columns> <asp:TemplateField HeaderStyle-VerticalAlign="... <HeaderTemplate>Fooba... <ItemTemplate><%# ...
I thought I understand ViewState, until I came cross this exception: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. This is a question asked by someone on a .NET mailing list. My first guess of what causing the ...
Anyone who has been using WPF has, by now, realized that one of the most versatile controls in Windows Forms is missing! I'm referring to the DataGridView. The WPF ListView does have a very powerful Grid View mode that can be used to get around this limitation for a lot of situations. However, for those times when you really do need the power and flexibility of a true data grid, you were out of luck unless you wanted to host the Windows Forms control. All of that changed at the end of January when ...
Great, I just set up this blog. Hopefully over the next few months I can blog about my Microsoft .Net development experience. Topics may include: Microsoft best (and worst) practices (i.e. evaluating the latest version of the Microsoft Data Access Block), ASP.Net (i.e. how I implemented the ObjectDataSource/Gridview/F... VB/C# comparisons, CSS Formatting, MS AJAX/ATLAS, ADO.Net, and anything else I find interesting related to the latest technology. Glad to see this forum is powered by Asp.net.' ...
Yes, yes, I know pro-ASP.NET Theme people will say "you can use CSS with themes, it's not an either-or!" but my thoughts on this matter are the interaction between Themes and CSS is weak and not well integrated. In a large sense Themes and CSS are attempting to accomplish the same thing: abstract the presentation, and assign uniformity throughout a web site. The problem I have with Themes is they don't really seem to offer many advantages over CSS, they introduce problems when using CSS, and CSS ...
I have used this technique before... use the item template for the edit controls and scrape the values by looping through the rows using events other than edit command. But I got lost for a bit, this article helped me get back on track: http://www.dotnetjohn.com/a... I'm using a gridview control and calling my "ReverseBind" from both page changes and also when the user clicks on a button that takes the final results and transfers the data to other places in the database. I loop ...
As I referenced earlier the top 10 mistakes when developing AJAX applications, I'd like also to mention the top 10 mistakes in web design. Speaking of AJAX, check this free updated online AJAX Cookbook. It's pretty cool really. Note: I got a comment on my GridView databinding events article (the most read page on my blog according to Google!!) asking me to provide a VB.NET code for the article. Well, in fact I didn't think this was that important until I was asked (as it's not the first time). I'll ...
The scaffold control is used to quickly create developer level admin pages. By dropping a single control on the page, you get a GridView and update controls. This control should appear in your Toolbox under SubSonic Components. Just set the TableName property and you're ready to go. <cc1:Scaffold ID="Scaffold1" runat="server" TableName="Products"><... It is also possible to apply some visual formatting through the EditTableCSSClass, EditTableItemCSSClass, EditTableLabelCSSClass ...
Some tasks are just too complicated for dynamic query building and/or require a greater level of control. To handle this, SubSonic supports stored procedures. Each stored procedure will produce an equivalent static method in the class defined in the configuration file. By default this is SPs. Each method will have one parameter for each stored procedure parameter and return a StoredProcedure object. SubSonic.StoredProcedure sp = SPs.CustOrderHist(customerID); The stored procedure can then either ...
Beyond all the basic filtering available in Fetch methods and collection filtering, SubSonic also provides a way to dynamically build SQL queries. To get started, create a new Query object, using the CreateQuery method. SubSonic.Query query = Product.CreateQuery(); or pass it the table name SubSonic.Query query = new SubSonic.Query(product.Tabl... or pass it the table schema SubSonic.Query query = new SubSonic.Query(Product.GetT... The last option will prevent SubSonic from loading ...
FetchAll The easiest way to return a list of objects is the FetchAll static method. It does just what the name says, returning a list of every object of that type in the database in IDataReader format, making it easily bindable to data controls like the GridView. GridView1.DataSource = Product.FetchAll();GridView... You can also pass the FetchAll method a SubSonic OrderBy. GridView1.DataSource = Product.FetchAll(SubSonic.O... = ...
The following links contain some great content for all levels of .net developers http://lvstechie.web1000.com/ http://msconline.maconstate... http://www.dotnetfun.com/Ar... and http://gridviewguy.com/ Enjoy! - pass on and have a good day ...
Asp.net 2.0 supports database cache dependencies. So changes in the Tables data can be notified and cache can expire. This is a very handy feature. Here is how we can do this <@ outputcache duration= "7200" varybyparam="CustomerID" sqldependency="DatabaseName... %> this means the cached page expires in 2 hours but also depends on database table. Any changes on the database table data will also invalidate the cache. Borrowed the following code from this link: Link to Improved Caching ...
Earlier today, Scott Guthrie posted an announcement of the release of ASP.NET CSS Control Adapters Beta3. The CSS Adapters are implementation of "new built-in extensibility mechanism in ASP.NET 2.0 called "control adapters" that allow you to plug-in into any ASP.NET server control and override, modify and/or tweak the rendering output logic of that control" aoms tp make a number of standard ASP.NET controls more CSS and standards friendly. Scott quoted the highlights of the most iportant new features ...
This review is about the book ASP.NET 2.0 MVP Hacks and Tips. Published by Wiley Publishing, Inc on end May 2006. 7 MVP's decided to put their knowledge together and create this book. The MVP's are: David Yack, Joe Mayo, Scott Hanselman, Fredrik Normén, Dan Wahlin, J. Ambrose Little, Jonathan D. Goodyear. If you are a ASP.NET developer you have propably already heard of these guys and if you haven't you need to take your work more seriously.This book is for experienced ASP.NET ...
A theme is a collection of property defines the look of pages and controls. Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in a markup language(i.e HTML). Themes are similar to cascading style sheets in that both themes and style sheets define a set of common attributes that can be applied to any page. However, themes differ from style sheets in the following ways:. Themes are control-based, not HTML-based. Themes can define many properties ...
Today someone came with the following question:I have a DataSet with a DataTable and I have set the property Caption of the DataColumn "InvNbr" to "Invoice Number". However when I bind my DataSet to the DataGridViewControl it will show the Name property of the DataColumn instead of the Caption and according to the MSDN Library the Caption property should be used to display a friendly-name, no?He was right about the fact that the Caption property should be used by UI controls for ...
When formatting a bound column in a gridview I noticed that nothing was happening until I set the HtmlEncode Property to False. I believe that by default it is set to true for security reasons.
GridView control offers a cool property "EnableSortingAndPagingCall... which enables the user to perform paging and sorting without any postbacks. Although the feature is pretty neat but it has some BIG limitations. First of all you can only use the DataSourceID property of the GridView to assign the data source. This rules out DataSets, DataTables and Custom Collections (My Favourite). So, only thing left for you to use is SqlDataSource and ObjectDataSource controls. When using SqlDataSource ...
You can easily pass multiple fields in the querystring when using the GridView HyperLinkField column. Take a look at the code below: <asp:GridView ID="gvCategories" runat="server" > <Columns> <asp:HyperLinkField DataTextField="CategoryName" DataNavigateUrlFields="Cate... DataNavigateUrlFormatString... /> </Columns> </asp:GridView> Easy is'nt it ...

I have just published a new article "Creating Crystal Reports Using Typed DataSet". You can view the article on GridViewGuy.

http://gridviewguy.com/ArticleDetails.aspx?articleID=201

Thanks,

I found a problem in some MS written code within the CSS Friendly adapters. Wasn't lazy, went and found the specific problem, and fixed it. The result - my code will be incorporated in the next version.

This is it: http://forums.asp.net/thread/1399881.aspx (CSS friendly GridView problems showing selected rows)

Yeah, it's a small thing, but still!

Sometimes you have two DropDownLists inside the GridView Item Tempalte Field. This scenario is encountered when the DropDownList have a parent-child relationship. So, you want to select some item from the parent and fill the child list based on the parent selection. If GridView control was not involved in this triangle then it would have been pretty simple but GridView makes it little different. The first thing that you need to do is to put the AutoPostBack on the parent DropDownList to true. Now, ...
Since, most of the applications these days require a feature to export the GridView to excel so I decided to make it into a custom control. The control was actually a simple user control which was converted to the custom control using the Visual Studio.NET 2005 Publish and ASP.NET build features. The control is in the form of the dll so you can simply download it and reference the assembly in your application. Once, you have the reference to the assembly you can simply use the control as following: ...
Did you know that there's no grid-like control in WPF 1.0? This post will show you how to get around that limitation. But first, may I say that the recently-released Orcas September CTP bits offers a great improvement at design-time when writing WPF applications. Instead of those three clunky tabs for .xaml, [Designer], and .xaml.cs that we had back in the June CTP, you now get the first glimpse of Microsoft's new cool “Split” view, which will become a part of ASP.NET in the Orcas timeframe! Very ...
CSS Friendly ASP.NET 2.0 Control Adapter kit has been recently updated with twice the number of adapters and some hefty enhancements: populate-on-demand and checkbox TreeView, Menus with postback, and much more... Here's a list of the new items in Beta 2.0, as listed in the adapters homepage: More adapters GridView Login ChangePassword PasswordRecovery CreateUserWizard LoginStatus Menu adapter now supports: Postback. Static and dynamic item templates. Distinct classes to mark the selected menu item, ...

A new article is published on the GridViewGuy which shows that how you can use the ASP.NET 2.0 Client Callbacks to display the data from the database based on the categoryID. You can read the article at the following link:

http://gridviewguy.com/ArticleDetails.aspx?articleID=199

Thanks,

I wanted to use GridView with inline inserts capability. Unfortunately it is not available out-of-the-box. I found Code Project's “ASP.NET GridView - Add a new record“ , but I don't like an idea to create dummy empty row as the first line in the DataSource. Another Code Project's GridView Redux article seems uses the same approach. I've tried “Real World GridView” , but it doesn't populate DropDownField with the List Values for Insert rows. The most promising looks Fredrik Normén's Use the GridView ...
Recently I posted Some workaround for ObjectDataSource: could not find a non-generic method '...' . Sinse that I done some investigation to understand better the reason of the problem and possible workarounds. Most of them are posted in thread “Dataset + ObjectDatasource + GridView + ASP.NET 2” .The problem perfectly described here. And it is reported to MS, but they don't want to address it. Actually Update code trying to executeby ASP.NET from ObjectDataSource very depends on fields and field properties, ...
I have a GridView with BoundField , and I want to access it value when GridView row is selected: <asp:GridView ID="grvCascadeRulesTemplates" runat="server" AutoGenerateColumns="False" DataKeyNames="CascadeRuleKey" DataSourceID="odsCascadeRul... <Columns> <asp:CommandField ShowSelectButton="True" SelectText="Show Values">asp:CommandField... <asp:BoundField DataField="CascadeRuleKey" HeaderText="CascadeRuleKey" ReadOnly="True" SortExpression="CascadeRule... /> <asp:BoundField ...
SqlDataSource allows you to Select/Insert/Update/Delete the data from the database without even writing a single line of code. But sometimes you need to dynamically assign a parameter. First let's take a look at the simple update which does not dynamically assign the parameters. In the example below I am using a simple GridView control and updating the UserName, FirstName and LastName. The Bind("UserName") will get the username from the database and display it on the screen and it will also send ...
I tried to use generated by VS 2005 typed dataset/adaptors with ObjectDataSource and got am error: Exception Details: System.InvalidOperationExce... ObjectDataSource 'odsCascadeRulesValues' could not find a non-generic method 'Update' that has parameters: .... I found the thread that suggested some workarounds, but the simple one “Change this OldValuesParameterFormatStr... to OldValuesParameterFormatStr... didn't work for me.I've found that the problem only happened if your ...
So, here is the story. I have a GridView which contains the ASP.NET CheckBox control. Each row also have the primary key of the database table. Now, I need to get the ID of the selected checkbox using JavaScript. I used a hidden field to store the ID of the row (The row is hidden and the user cannot see it on the display but you can see the value if you do the view source). Now, I like to access the hidden field of the selected row of the GridView. <asp:TemplateField> <ItemTemplate> <asp:CheckBox ...
Hello. Welcome. Hey. Nice to see you. An informal beginning to a suitably informal activity. And not a very interesting first post. I am a computer programmer who practices web development. And I've never had a proper presence on the web. So I'm taking some steps to fill that hole. No, I don't always write in such short sentences. No, I'm not trying to be funny. An explanation, mostly for my own benefit, this blog, large parts of which I hope to reproduce on my own site, is dual purposed for my own ...
If you have used SqlDataSource control with the GridView, FormView or the DetailsView and updating the data in the database using the UpdateCommand and UpdateParameters of the SqlDataSource control then you might be familiar with this error. The error "Could not find control 'xxx' in ControlParameter 'xxx'" is thrown when the ASP.NET is not able to find the requested control defined in the Update ControlParameters. Check out the code below which will throw the above exception: <asp:DetailsView ...
I love using a nice little tab control on my web pages but I never seem to find an good solution…well a FREE (!) one anyway! There are some great tab controls out there to buy but I have never really looked at them as paying for controls is not in my vocabulary. This little control is probably no match for one of those but for a simple and FREE solution look no further! The problem I have with the current solutions I use are 1. The javascript and CSS solution using relative positioning and ...

I have just published a new article on GridViewGuy about Bread Crumbs in ASP.NET. You can read the article at the following link:

http://gridviewguy.com/ArticleDetails.aspx?articleID=198 

 

Hope you like it!

“Atlas - Asynchronous Partial Page Rendering in ASP.Net” : A look at the partial page rendering feature provided by the Atlas UpdatePanel control. The following samples are included in the article: UpdatePanel: Step by Step Usage Basic Sample - UpdatePanel to update a databound GridView. UpdatePanel - Asynchronously Auto-Refresh a databound GridView without any user action, using the Atlas Timer Control Nested UpdatePanels UpdatePanel within an ASP.Net WebPart. Any feedback is highly ...
If you have DropDownLists and LinkButtons inside the GridView control and you try to export the GridView to excel then the controls contained in the GridView are also exported to the excel spreadsheet. You can remove those controls and replace them with their selected value. Here is a small method called DisableControls that takes Control as parameter and replaces the DropDownLists and LinkButtons with Literal control. private void DisableControls(Control gv){LinkButton lb = new LinkButton();Literal ...
I have just written a new article "Extensive Study of the GridView Export to Excel" in which I talked about different ways that you can use to export the GridView to excel. You can check out the article at the following link. http://gridviewguy.com/Arti... powered by IMHO 1.3 ...
Those of you who have exported the GridView to Excel might have noticed that if you try to export a GridView with a column which displays number like 0034, 0012, 0045 etc. In other words the first digit is a '0' and the column is a varchar column then the exported excel file contains the data as 34, 12, 45. So, it removes all the zero's from the column data. You can easily keep the zero's by making small modification in the code. You can achieve this by adding style to the column. Check out the complete ...

The RSS Feeds for the GridViewGuy is now available. You can use any RSS Reader control to display the feeds on your website.

 

 

powered by IMHO 1.3

source: http://weblogs.asp.net/scot... ASP.NET Topics Sending Email in ASP.NET 2.0: This is a great article from Scott Mitchell that demonstrates how to use the new System.Net.Mail APIs in .NET 2.0 to send email from an ASP.NET application. Sending Email in ASP.NET 2.0: HTML-Formatted Emails, Attachments, and Gracefully Handling SMTP Exceptions: This is a great follow-up article on email from Scott Mitchell that discusses some more advanced ...
ASP.NET provides the funtionality of securing many different files which include .aspx, .resources, .config etc. You can place the files inside a folder and make few adjustments in the web.config and that is it. Now, your files are secured for malacious users. Below is a small configuration that enables the protection on the files contained in the MySecureFolder. <location path="MySecureFolder"> <system.web> <authorization> <deny users="?"/> </authorization> </system.web> ...