﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - Adding an attribute to the grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adding-an-attribute-to-the-grid/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Adding an attribute to the grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adding-an-attribute-to-the-grid/</link><pubDate>Mon, 20 May 2013 00:05:40 GMT</pubDate><dc:creator>bernard</dc:creator><description>Hi,&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;Because you just need 1 parameter from server, maybe you can put the attributes outside of our WebGrid. If you're using HiddenDataMember, the attributes will be rendered recursively and it won't be effective. However, attributes in WebGrid class, won't be rendered inside WebGrid but you can access it in server so it will be better if you're using another element like form or div container to achieve this scenario. Also please ensure if the element have "server" value for runat attribute. So it will be rendered in client-side. Hope this helps.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;Regards,&lt;br /&gt;Bernard&lt;/div&gt;</description></item><item><title>Adding an attribute to the grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adding-an-attribute-to-the-grid/</link><pubDate>Fri, 17 May 2013 13:52:23 GMT</pubDate><dc:creator>questica</dc:creator><description>&lt;p&gt;What I want to do is be able to set a customer html attribute to the root element in the grid. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;div data-customattribute="..."&amp;gt;&lt;/p&gt;
&lt;p&gt;This div being the root element for the grid&lt;/p&gt;
&lt;p&gt;&amp;lt;/div&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;This would allow me to set my own custom attributes that I would use in other clientside scripts that I use throughout my application. &lt;/p&gt;</description></item><item><title>Adding an attribute to the grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adding-an-attribute-to-the-grid/</link><pubDate>Thu, 16 May 2013 06:06:59 GMT</pubDate><dc:creator>bernard</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;&lt;p&gt;To resolve this matter, you can put the attributes in WebGridCells' CustomAttributes. However with the code that you used before, the attributes can only be accessed in server side because it won't be rendered in client-side. Just like you though, the attributes that you put in server-side won't be rendered in client-side. Here's the walkthrough how to put the value inside WebGridCell level:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.intersoftpt.com/Support/WebGrid/KB/Use-more-than-one-hidden-field-in-both-server-and-client-side-of-WebGrid/"&gt;http://www.intersoftpt.com/Support/WebGrid/KB/Use-more-than-one-hidden-field-in-both-server-and-client-side-of-WebGrid/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Although, if you only want to use single custom attribute, it will be better if you're using HiddenField that contains string of your customAttributes. Is there any scenario that you want to achieve regarding this custom attributes? Look forward to hear any feedback from you so I can help you further.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Bernard&lt;/p&gt;</description></item><item><title>Adding an attribute to the grid</title><link>http://www.intersoftsolutions.com/Community/WebGrid/Adding-an-attribute-to-the-grid/</link><pubDate>Mon, 13 May 2013 11:08:35 GMT</pubDate><dc:creator>questica</dc:creator><description>&lt;p&gt;I have tried adding an attribute to the grid in the Load_Page method of the page as follows:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;grid.Attributes.Add("data-customattribute", "value");&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;However, when the page is rendered, the attribute is nowhere to be found. Are you specifically preventing custom attributes from being created and attached to the grid? Is there another way I can create a custom attribute on the grid?&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;I've noticed that this functionality seems possible at the row and cell level, however it doesn't seem possible for the actual grid.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;Should I be adding the attributes to a child element of the grid? If so, can you give a code example?&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>