<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-171924705653813582.post6673125968458923327..comments</id><updated>2008-10-17T15:53:18.259+03:00</updated><title type='text'>Comments on It Could Be Done!: Implementing ITemplate as Anonymous Method</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://couldbedone.blogspot.com/feeds/6673125968458923327/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default'/><link rel='alternate' type='text/html' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html'/><author><name>Yuriy Solodkyy</name><uri>http://www.blogger.com/profile/04926659302956943479</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-171924705653813582.post-191752213741090400</id><published>2008-10-17T15:53:00.000+03:00</published><updated>2008-10-17T15:53:00.000+03:00</updated><title type='text'>Check out the following link, I used it to do an E...</title><content type='html'>Check out the following link, I used it to do an Eval from code-behind... basically you add a handler for databinding and use the DataBinder.Eval() function to pull it off.&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;http://forums.asp.net/t/1298261.aspx&lt;BR/&gt;&lt;BR/&gt;Good luck!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default/191752213741090400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default/191752213741090400'/><link rel='alternate' type='text/html' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html?showComment=1224247980000#c191752213741090400' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html' ref='tag:blogger.com,1999:blog-171924705653813582.post-6673125968458923327' source='http://www.blogger.com/feeds/171924705653813582/posts/default/6673125968458923327' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-171924705653813582.post-4615507802666291605</id><published>2008-10-03T12:34:00.000+03:00</published><updated>2008-10-03T12:34:00.000+03:00</updated><title type='text'>Thanks for the tip!I also needed to add a "Eval-li...</title><content type='html'>Thanks for the tip!&lt;BR/&gt;&lt;BR/&gt;I also needed to add a "Eval-like" statement to this, to be able to dynamically bind the content of the TemplateField with the data object.&lt;BR/&gt;&lt;BR/&gt;A solution is to use the DataBinding event of the template's controls, like this:&lt;BR/&gt;&lt;BR/&gt;        TemplateField emailField = new TemplateField();&lt;BR/&gt;        emailField.HeaderText = "Dynamically Added E-Mail Field";&lt;BR/&gt;        emailField.ItemTemplate = new GenericTemplateImplementation( delegate( Control container )&lt;BR/&gt;        {&lt;BR/&gt;            Button btn = new Button();&lt;BR/&gt;            btn.DataBinding += new EventHandler(btn_DataBinding);&lt;BR/&gt;            container.Controls.Add(btn);&lt;BR/&gt;        } );&lt;BR/&gt;        GridView1.Columns.Add( emailField );&lt;BR/&gt;    &lt;BR/&gt;-----&lt;BR/&gt;&lt;BR/&gt;    void btn_DataBinding( object sender, EventArgs e )&lt;BR/&gt;    {&lt;BR/&gt;        Button btn = (Button)sender;&lt;BR/&gt;        object dataItem = DataBinder.GetDataItem(btn.NamingContainer);&lt;BR/&gt;        btn.Text = (string)DataBinder.Eval(dataItem, "TheBoundedProperty");&lt;BR/&gt;&lt;BR/&gt;        // or rather, if you know the dataItem's type (called 'MyDataType' here):&lt;BR/&gt;        MyDataType dataItem = (MyDataType)DataBinder.GetDataItem(btn.NamingContainer);&lt;BR/&gt;        btn.Text = dataItem.TheBoundedProperty;&lt;BR/&gt;    }</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default/4615507802666291605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default/4615507802666291605'/><link rel='alternate' type='text/html' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html?showComment=1223026440000#c4615507802666291605' title=''/><author><name>Julien Patte</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html' ref='tag:blogger.com,1999:blog-171924705653813582.post-6673125968458923327' source='http://www.blogger.com/feeds/171924705653813582/posts/default/6673125968458923327' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-171924705653813582.post-2414643550111413988</id><published>2008-04-16T23:43:00.000+03:00</published><updated>2008-04-16T23:43:00.000+03:00</updated><title type='text'>How would you add a Eval statement to this? Take:[...</title><content type='html'>How would you add a Eval statement to this? Take:&lt;BR/&gt;&lt;BR/&gt;[ asp:LinkButton ID="lnk" runat="server" CommandName="lnk" &lt;BR/&gt;            CommandArgument='&lt; % #Eval("Id") % &gt; '] &lt; % #Eval("Name") % &gt; [ / asp:LinkButton]</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default/2414643550111413988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default/2414643550111413988'/><link rel='alternate' type='text/html' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html?showComment=1208378580000#c2414643550111413988' title=''/><author><name>colinbashbash</name><uri>http://www.blogger.com/profile/03969335674433118497</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html' ref='tag:blogger.com,1999:blog-171924705653813582.post-6673125968458923327' source='http://www.blogger.com/feeds/171924705653813582/posts/default/6673125968458923327' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-171924705653813582.post-3358194197858263673</id><published>2008-03-30T06:22:00.000+03:00</published><updated>2008-03-30T06:22:00.000+03:00</updated><title type='text'>Thanks...this really helped out with creating dyna...</title><content type='html'>Thanks...this really helped out with creating dynamic controls.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default/3358194197858263673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/171924705653813582/6673125968458923327/comments/default/3358194197858263673'/><link rel='alternate' type='text/html' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html?showComment=1206847320000#c3358194197858263673' title=''/><author><name>Crazy T-Mack</name><uri>http://www.highway-1.com</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://couldbedone.blogspot.com/2007/07/implementing-itemplate-as-anonymous.html' ref='tag:blogger.com,1999:blog-171924705653813582.post-6673125968458923327' source='http://www.blogger.com/feeds/171924705653813582/posts/default/6673125968458923327' type='text/html'/></entry></feed>