tag:blogger.com,1999:blog-6907873803403737979.post589996825995862499..comments2023-10-16T12:48:46.251+01:00Comments on C# Bits: A New Way To Do Column Generation in Dynamic Data 4 (UPDATED)Stephen J. Naughtonhttp://www.blogger.com/profile/17435527974910745156noreply@blogger.comBlogger29125tag:blogger.com,1999:blog-6907873803403737979.post-60804466247638836892013-12-11T11:16:10.789+00:002013-12-11T11:16:10.789+00:00I posted a reply to the thread on StackOverflow
S...I posted a reply to the thread on StackOverflow<br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-75103771761657817792013-12-10T15:14:11.227+00:002013-12-10T15:14:11.227+00:00Hi there, awesome post here BTW.
I stumbled on it...Hi there, awesome post here BTW.<br /><br />I stumbled on it after searching for random things to solve my problem here:<br />http://stackoverflow.com/questions/20497450/asp-net-dynamic-data-full-scaffolding-without-datacontext-objectcontext<br /><br />I wonder if you could take a look and suggest a workaround there, seeing as you are very knowledgeable on Dynamic Data :)<br /><br />Cheers,<br />Julianojulealgonhttps://www.blogger.com/profile/13518771072825971877noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-89632767343031002892013-10-24T23:45:30.761+01:002013-10-24T23:45:30.761+01:00Hi there I have not solved the issue as there has ...Hi there I have not solved the issue as there has been no one to do the VB conversion for me I'm a C# coder. It need someone doing a lot of VB to do it and I don't know any experienced VB programmers sorry :(<br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-43164382486088624382013-10-24T23:35:25.859+01:002013-10-24T23:35:25.859+01:00Hay, did you ever solved that, i have the same pro...Hay, did you ever solved that, i have the same problem?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-55616106097422011312013-03-12T13:40:03.075+00:002013-03-12T13:40:03.075+00:00Hi Steve,
This is the post I pointed to from your...Hi Steve,<br /><br />This is the post I pointed to from your blog on the older method of hiding columns.<br /><br />This code is converting to vb.net well, with one unfortunate exception.<br />In the global.asax file you have this line of code:<br /><br />Private Shared s_defaultModel As New CustomMetaModel(GetVisibleColumns()<br /><br />which is not passing any parameters, but the function in global.asax is expecting a collection of columns:<br /><br /> Public Shared Function GetVisibleColumns(columns As IEnumerable(Of MetaColumn)) As IEnumerable(Of MetaColumn)<br /> Dim visibleColumns = From c In columns Where IsHidden(c) Select c<br /> Return visibleColumns<br /> End Function<br /><br />- so it won't compile and I don't know what to pass into it. I'm thinking the problem has to do with the delegate, but I don't know how to solve it.<br /><br />Thanks alot!<br /><br />John (Don't push yourself to answer this in a hurry, I know you are on the mend!)<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-3921591262847862262012-10-31T11:09:09.019+00:002012-10-31T11:09:09.019+00:00you can get it from here
Northwind
Steveyou can get it from here<br /><a href="http://northwinddatabase.codeplex.com/" rel="nofollow">Northwind</a><br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-33575191394564462072012-10-31T10:58:53.811+00:002012-10-31T10:58:53.811+00:00Hi Steve,
I don't have northwind DB so that&#...Hi Steve,<br /><br />I don't have northwind DB so that's why not able to run the project completely. I am getting an error at line:-<br />var visibleColumns = from c in columns. columns variable is providing the issue.Anonymoushttps://www.blogger.com/profile/16574144255603850029noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-29889364284618319312012-10-31T10:46:09.663+00:002012-10-31T10:46:09.663+00:00Hi Navneet, not sure where you are getting this er...Hi Navneet, not sure where you are getting this error, have you downloaded the sample and tested that?<br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-23321217396712568552012-10-31T10:13:03.057+00:002012-10-31T10:13:03.057+00:00Hi,
I have implemented the solution you provided ...Hi,<br /><br />I have implemented the solution you provided to hide the columns in specific template. I am getting an error at global.asax <br />Error "Could not find an implementation of the query pattern for source type 'System.Collections.Generic.IEnumerable'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?<br />I am facing this error at method <br />_____________*****________________<br />public static IEnumerable GetVisibleColumns(IEnumerable columns)<br /> {<br /> var visibleColumns = from c in columns<br /> where IsShown(c)<br /> select c;<br /> return visibleColumns;<br /> }<br />_________******_____________<br />I have written this method in global.asax.cs file.<br />please help me.Anonymoushttps://www.blogger.com/profile/16574144255603850029noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-14497614083280000232012-08-22T15:46:40.185+01:002012-08-22T15:46:40.185+01:00Can you send me a sample project that uses Northwi...Can you send me a sample project that uses Northwind and I will test here?<br /><br />Steve<br />P.S. my e-mail address is in the top right of the page.Stephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-35453361113780526372012-08-22T15:03:15.343+01:002012-08-22T15:03:15.343+01:00Steve,
It is not working.
See my req. is I have t...Steve,<br /><br />It is not working.<br />See my req. is I have to show a column in Insert and Edit Page<br />but not in List and Listdetails.<br /><br />I am doing same as what you told but it's not working. May be I am wrong somewhere.<br />If you have any sample for same then please send to viv_bit at yahooAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-89451547768455689792012-08-22T14:54:17.351+01:002012-08-22T14:54:17.351+01:00Try downloading and looking at the sameple.
Steve...Try downloading and looking at the sameple.<br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-65803626425566459412012-08-22T14:53:11.362+01:002012-08-22T14:53:11.362+01:00You don't need to pass anything in in Global.a...You don't need to pass anything in in Global.asax you just add the attribute to you buddy/metadata classes.Stephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-17487489217562199652012-08-22T14:23:44.746+01:002012-08-22T14:23:44.746+01:00But the problem is I am not able to pass getVisibl...But the problem is I am not able to pass getVisiblecolumns in CustomMetaModel. In Global.asax I am doing like this -<br /> private static MetaModel s_defaultModel = new CustomMetaModel(); //MetaModel();<br /><br />and in MetaData class -<br />public class EmployeeMetadata<br /> {<br /> [HideColumnIn(PageTemplate.List)] [UIHint("TextPassword")] <br />public object Pass{get; set;} <br /> }<br /><br />And how to pass one more PageTemplate.Edit in HideColumnIn<br /><br />Please provide in detail.<br /><br />ThanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-61318405807140002632012-08-22T12:28:04.330+01:002012-08-22T12:28:04.330+01:00Hi there, that is what this sample will do, there ...Hi there, that is what this sample will do, there is no extension methods to call you just replce the metsmodel with this one and then add you attribute and it all just works.<br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-71664929214938353582012-08-22T11:53:12.509+01:002012-08-22T11:53:12.509+01:00Hi Steve,
Where and how to call the extension met...Hi Steve,<br /><br />Where and how to call the extension methods. My requirement is like I want to show a column in Insert.aspx but not in other pages.<br />Please provide in detail.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-74600106367093315872011-12-07T13:25:28.757+00:002011-12-07T13:25:28.757+00:00Hi Christian, send me an e-mail and I will explain...Hi Christian, send me an e-mail and I will explain a method you could use.<br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-43249262934191280892011-12-07T13:20:54.069+00:002011-12-07T13:20:54.069+00:00Hi Steve,
Thank you so much for sharing this with...Hi Steve,<br /><br />Thank you so much for sharing this with us, it's great!<br /><br />Like Sachin, I also need to hide certain columns in the FormView but show them in the GridView inside of the ListDetails.aspx page.<br /><br />Can you please show us how to implement such functionality?<br /><br />Thank you in advance.Christiaanhttps://www.blogger.com/profile/14048915748406268948noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-20892380083328633122011-10-14T18:52:34.387+01:002011-10-14T18:52:34.387+01:00I'll send you that sample I have if you email ...I'll send you that sample I have if you email me direct<br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-14466473727076730542011-10-14T18:39:55.951+01:002011-10-14T18:39:55.951+01:00In the ListDetails.aspx page, I have both Insert F...In the ListDetails.aspx page, I have both Insert FormView and Edit GridView. I want set of columns to be hidden only in the FormView but must be shown in the gridview. Since the code sample given here works against a page template, I'm not sure how this can be implemented in this case.Sachinnoreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-46112010664048246112011-10-14T18:29:17.663+01:002011-10-14T18:29:17.663+01:00this just works ford any page template, as it work...this just works ford any page template, as it works at the meta model level<br /><br />SteveStephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-6279075792876497392011-10-14T18:19:03.147+01:002011-10-14T18:19:03.147+01:00How can this be implemented in ListDetails.aspx te...How can this be implemented in ListDetails.aspx template which has got both edit and insert forms in it?Sachinnoreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-52622732800869072042010-07-15T09:55:55.206+01:002010-07-15T09:55:55.206+01:00I'll redo this with some ideas I've had si...I'll redo this with some ideas I've had since.<br /><br />Steve :)Stephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-7617843825949798882010-07-15T08:24:05.512+01:002010-07-15T08:24:05.512+01:00Hey Steve,
Thank you for the great post.
I had th...Hey Steve,<br />Thank you for the great post.<br /><br />I had the same problem as Dennis Brulic (2 June). I wanted to hide columns from two or more actions (e.g. List and Insert) at the same time. Here is my solution but would appreciate any feedback on improving it:<br /><br />1. Created a 2nd HideColumn Attribute (e.g. for Insert) from Listing 3<br /><br />[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]<br />public class HideColumnInsertAttribute : Attribute<br />{<br /> public PageTemplate PageTemplate { get; private set; }<br /> public HideColumnInsertAttribute() { }<br /> public HideColumnInsertAttribute(PageTemplate lookupTable)<br /> {<br /> PageTemplate = lookupTable;<br /> }<br />}<br /><br />2. Edited the code from Listing 6. This example handles two actions (List and Insert) but could be edited to handle more:<br /> public static Boolean IsShown(MetaColumn column)<br /> {<br /> // need to get the current page template <br /> var page = (System.Web.UI.Page)System.Web.HttpContext.Current.CurrentHandler;<br /> var pageTemplate = page.GetPageTemplate();<br /> var hideIn = column.GetAttribute<HideColumnInAttribute>();<br /> var hideInsert = column.GetAttribute<HideColumnInsertAttribute>();<br /><br /> if (pageTemplate == PageTemplate.Insert)<br /> {<br /> if (hideInsert != null) return !((hideInsert.PageTemplate & pageTemplate) == pageTemplate);<br /> }<br /><br /> if (pageTemplate == PageTemplate.List)<br /> {<br /> if (hideIn != null)<br /> return !((hideIn.PageTemplate & pageTemplate) == pageTemplate);<br /> }<br /> return true;<br /> }<br /><br />3. Use in metadata as appropriate (see listing 8):<br /><br /> [DisplayName("Field 1")]<br /> [HideColumnIn (PageTemplate.List)]<br /> [HideColumnInsert (PageTemplate.Insert)]<br /> public string field1 { get; set; }<br /><br />Hope this helps.<br /><br />Cheers,<br />GrantAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6907873803403737979.post-73853794517417353412010-07-13T17:10:06.321+01:002010-07-13T17:10:06.321+01:00Hi there yes the usual reason that metadata is not...Hi there yes the usual reason that metadata is not recognised is namespace issues, my e-mail is at the top of the site e-mail me and I'll see what I can do.<br /><br />Steve :)Stephen J. Naughtonhttps://www.blogger.com/profile/17435527974910745156noreply@blogger.com