|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Repeater questionI display ads via repeater - name, address, text, anonymous (yes or no) etc.. Repeater values are loaded from database. If ad is not anonymous I want to display everything but if it is anonymous I need display completely other structure - only text and before it header anonymous. E.g. Name1, Address1 // Not anonymous ad Link to other ads from this person Text1 This is anonymous ad // Anonymous ad Text1a Name2, Address2 // Not anonymous ad Link to other ads from this person Text2 Name3, Address3 // Not anonymous ad Link to other ads from this person Text3 Is it possible to make it in repeater ? Can I have 2 different templates to use in repeater ? (I can't display it using 2 different repeaters because they are sorted by date) Thank you Hi Madar,
Welcome to ASPNET newsgroup. As for the problem on dynamically using different template depend on the datasource item's value in repeater control, based on my experience, the buildin asp.net template databound controls (repeater, datalist....) don't support this. If we really need to perform such work, we can achieve this through creating our own custom Repeater template control and define the databinding logic. In addition, I've also seen some community guys who creating custom wrapper control to perform such works, here is a tech article in code project: #A Templated databound Repeater control with per-row template selection http://www.codeproject.com/aspnet/ObjectRepeater.asp#xx960299xx In my opinion, I'd rather suggest you try creating a custom template databound control and just choose template in your control's CreateChildControls period. This will make things easier as the above article means (but will have less reusability). For detailed reference on creating custom template databound control, you can refer to the following msdn reference; #Templated Data-Bound Control Sample http://msdn.microsoft.com/library/en-us/cpguide/html/cpcontemplateddatabound controlsample.asp?frame=true Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) A Templated databound Repeater control with per-row template selection -------------------- Show quoteHide quote | Thread-Topic: Repeater question microsoft.public.dotnet.framework.aspnet.webcontrols:9989| thread-index: AcWMdQ2BLxWucdISQiefa3h5c73qnQ== | X-WBNR-Posting-Host: 194.212.229.226 | From: =?Utf-8?B?TS5ELk0u?= <madar@community.nospam> | Subject: Repeater question | Date: Tue, 19 Jul 2005 08:18:01 -0700 | Lines: 29 | Message-ID: <A7DF2775-003E-4763-94C2-227D1C38D***@microsoft.com> | MIME-Version: 1.0 | Content-Type: text/plain; | charset="Utf-8" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Content-Class: urn:content-classes:message | Importance: normal | Priority: normal | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl Show quoteHide quote | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols | | Hi, | | I display ads via repeater - name, address, text, anonymous (yes or no) | etc.. Repeater values are loaded from database. If ad is not anonymous I want | to display everything but if it is anonymous I need display completely other | structure - only text and before it header anonymous. | | E.g. | Name1, Address1 // Not anonymous ad | Link to other ads from this person | Text1 | | This is anonymous ad // Anonymous ad | Text1a | | Name2, Address2 // Not anonymous ad | Link to other ads from this person | Text2 | | Name3, Address3 // Not anonymous ad | Link to other ads from this person | Text3 | | Is it possible to make it in repeater ? Can I have 2 different templates to | use in repeater ? | (I can't display it using 2 different repeaters because they are sorted by | date) | | Thank you | Hi Madar,
Have you got any further progress on this issue and is the suggestions in my last reply somewhat helps? If there're anything else we can help, please feel free to post here. Thanks, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) -------------------- Show quoteHide quote | X-Tomcat-ID: 42653231 microsoft.public.dotnet.framework.aspnet.webcontrols:9996| References: <A7DF2775-003E-4763-94C2-227D1C38D***@microsoft.com> | MIME-Version: 1.0 | Content-Type: text/plain | Content-Transfer-Encoding: 7bit | From: stch***@online.microsoft.com (Steven Cheng[MSFT]) | Organization: Microsoft | Date: Wed, 20 Jul 2005 02:33:27 GMT | Subject: RE: Repeater question | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols | Message-ID: <JF03xNNjFHA.3***@TK2MSFTNGXA01.phx.gbl> | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | Lines: 85 | Path: TK2MSFTNGXA01.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl Show quoteHide quote | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122 http://msdn.microsoft.com/library/en-us/cpguide/html/cpcontemplateddatabound| | Hi Madar, | | Welcome to ASPNET newsgroup. | As for the problem on dynamically using different template depend on the | datasource item's value in repeater control, based on my experience, the | buildin asp.net template databound controls (repeater, datalist....) don't | support this. If we really need to perform such work, we can achieve this | through creating our own custom Repeater template control and define the | databinding logic. In addition, I've also seen some community guys who | creating custom wrapper control to perform such works, here is a tech | article in code project: | | #A Templated databound Repeater control with per-row template selection | http://www.codeproject.com/aspnet/ObjectRepeater.asp#xx960299xx | | In my opinion, I'd rather suggest you try creating a custom template | databound control and just choose template in your control's | CreateChildControls period. This will make things easier as the above | article means (but will have less reusability). For detailed reference on | creating custom template databound control, you can refer to the following | msdn reference; | | #Templated Data-Bound Control Sample | Show quoteHide quote | controlsample.asp?frame=true | | Steven Cheng | Microsoft Online Support | | Get Secure! www.microsoft.com/security | (This posting is provided "AS IS", with no warranties, and confers no | rights.) | | | | | | | | | | | A Templated databound Repeater control with per-row template selection | -------------------- | | Thread-Topic: Repeater question | | thread-index: AcWMdQ2BLxWucdISQiefa3h5c73qnQ== | | X-WBNR-Posting-Host: 194.212.229.226 | | From: =?Utf-8?B?TS5ELk0u?= <madar@community.nospam> | | Subject: Repeater question | | Date: Tue, 19 Jul 2005 08:18:01 -0700 | | Lines: 29 | | Message-ID: <A7DF2775-003E-4763-94C2-227D1C38D***@microsoft.com> | | MIME-Version: 1.0 | | Content-Type: text/plain; | | charset="Utf-8" | | Content-Transfer-Encoding: 7bit | | X-Newsreader: Microsoft CDO for Windows 2000 | | Content-Class: urn:content-classes:message | | Importance: normal | | Priority: normal | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl | | Xref: TK2MSFTNGXA01.phx.gbl | microsoft.public.dotnet.framework.aspnet.webcontrols:9989 | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols | | | | Hi, | | | | I display ads via repeater - name, address, text, anonymous (yes or no) | | etc.. Repeater values are loaded from database. If ad is not anonymous I | want | | to display everything but if it is anonymous I need display completely | other | | structure - only text and before it header anonymous. | | | | E.g. | | Name1, Address1 // Not anonymous ad | | Link to other ads from this person | | Text1 | | | | This is anonymous ad // Anonymous ad | | Text1a | | | | Name2, Address2 // Not anonymous ad | | Link to other ads from this person | | Text2 | | | | Name3, Address3 // Not anonymous ad | | Link to other ads from this person | | Text3 | | | | Is it possible to make it in repeater ? Can I have 2 different templates | to | | use in repeater ? | | (I can't display it using 2 different repeaters because they are sorted | by | | date) | | | | Thank you | | | |
Render TreeViewControls in .net 2003
Resolving datasource expression Working with Mac Safari Browser How do I find out the page name in ASP composite control does not fire event Resolving datasource expression return parameter WebControl.Style and ViewState Re: CustomValidator control BUG How do I get a custom Control Designer to write to the HTML of my control? |
|||||||||||||||||||||||