Only one featured add?http://forums.asp.net/t/1001971.aspx/1?Only+one+featured+add+Thu, 10 Jan 2008 17:17:19 -050010019711322023http://forums.asp.net/p/1001971/1322023.aspx/1?Only+one+featured+add+Only one featured add? Hi,<br> Only one featured add is showing up on the main page even though I have 3 selected. I am still new to this and can't figure out how to change it so it displays all three. <br> <br> Can anyone help?<br> <br> Thanks<br> 2006-06-22T15:30:06-04:001323317http://forums.asp.net/p/1001971/1323317.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? Well, I figured out what seems to be the easiest solution to this...albeit not the best.&nbsp; I changed the following function to what is below:<br> <br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Public Shared Function</font> GetFeaturedAd() <font color="#0000ff"> As</font> DataTable<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Dim</font> table <font color="#0000ff">As</font> AdsDataComponent.AdsDataTable = AdsDB.GetFeaturedAdsSelection(3)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Return</font> table<br> &nbsp;&nbsp;&nbsp;<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; End Function</font><br> <br> <br> And in the control FeaturedAd.ascx I changed everything that said AdID with Id.<br> <br> That made my 3 ads show up. <br> 2006-06-23T18:11:22-04:001327721http://forums.asp.net/p/1001971/1327721.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>The kit was designed to pick one of 1 or more cached feature ads and show that. Your approach for showing a specified number of ads will work. If I were going to add the feature I would consider using the the generic List&lt;&gt; and duplicating the structure of the existing methods to get the benefits of caching:</p> <font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">static</font><font size="2"> </font><font color="#008080" size="2">List</font><font size="2">&lt;</font><font color="#008080" size="2">CachedFeaturedAd</font><font size="2">&gt; GetFeaturedAdList(</font><font color="#0000ff" size="2">int</font><font size="2"> displayCount)<br> {<br> &nbsp;&nbsp; </font><font color="#0000ff" size="2">return</font><font size="2"> GetFeaturedAdList(</font><font color="#008080" size="2">HttpContext</font><font size="2">.Current, displayCount);<br> </font><font size="2">}</p> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">static</font><font size="2"> </font><font color="#008080" size="2">List</font><font size="2">&lt;</font><font color="#008080" size="2">CachedFeaturedAd</font><font size="2">&gt; GetFeatureAdList(</font><font color="#008080" size="2">HttpContext</font><font size="2"> context, </font><font color="#0000ff" size="2">int</font><font size="2"> displayCount)<br> {<br> </font><font color="#008000" size="2">// check if feature is in cache<br> </font><font color="#008000" size="2">// if not add to cache<br> </font><font size="2">}</font></p> <p><font size="2">DisplayCount could be passed in &lt;asp:Parameter&gt; from FeatureAd.ascx ObjectDataSource. Otherwise FeatureAd.asc would stay the same.</font></p> 2006-06-28T22:18:55-04:001346524http://forums.asp.net/p/1001971/1346524.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>Hello,</p> <p>May I know where can I activate the featuredAd?&nbsp; Anybody .... Please help.</p> <p>Regards,</p> 2006-07-20T08:12:55-04:001346681http://forums.asp.net/p/1001971/1346681.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>It's already built in. There are 3 AdLevels if I remember right off hand.</p> <p>Uspecified = 0<br> Normal = 10<br> Featured = 50</p> <p>So if you save an ad with AdLevel 50 it will be a featured item</p> 2006-07-20T12:12:08-04:001346762http://forums.asp.net/p/1001971/1346762.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>Do you mean the person who post until 50 items then only can be shown on the&nbsp;home (or default) page?&nbsp; Don't quite understand .... correct me if i am wrong.&nbsp; Can anybody tell me more about this?&nbsp; I thought only administrator got the authority to decide who/what to be appeared on the main page ....</p> <p>So ..... if that is the case, how can I customise it?&nbsp; What if I (as an adminitrator)&nbsp;want a specific Ad (with photo) to be appeared at the home page?&nbsp; Please help.</p> 2006-07-20T13:21:31-04:001346814http://forums.asp.net/p/1001971/1346814.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>That's not what I mean. Those values are saved to the database. So if an ad has a level of 50 it is considered a Featured Ad.</p> <p>You, as the adminstrator can decide which ads are to be featured or not. So if you login as administrator and manage your ads, there is an option to set the selected ads as featured</p> 2006-07-20T13:57:26-04:001346869http://forums.asp.net/p/1001971/1346869.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>I think you are refering to &quot;Manage Ads &amp; features&quot; under Site Administration.</p> <p>I tried to&nbsp;play with&nbsp;all kind of selection,&nbsp;click the &quot;query&quot; button, but it doesn't work, it showed &quot;An error occurred. Please contact the <a id="MailLink" href="mailto:admin@pricenet.com.sg">site administrator</a>&quot;, may I know what could go wrong?</p> 2006-07-20T14:37:16-04:001346920http://forums.asp.net/p/1001971/1346920.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>It's kind of hard to tell what your exact error is. But if I remember correct there is an error with a declaration of a variable.</p> <p>There was a previous post about this:</p> <p>The error is on line 167 in the 'Admin/Ads.aspx' file. maxPrice is defined as Type 'int32'. Change it to 'Decimal'.</p> <p>You should turn off Custom Errors in your web.config until you&nbsp;upload it to production&nbsp;so you can see the exact error messages instead of that custom error page</p> 2006-07-20T15:16:17-04:001346972http://forums.asp.net/p/1001971/1346972.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? I've got it.&nbsp; Thank you very much! 2006-07-20T15:53:15-04:001397464http://forums.asp.net/p/1001971/1397464.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>[quote user=&quot;jherch77&quot;]Well, I figured out what seems to be the easiest solution to this...albeit not the best.&nbsp; I changed the following function to what is below:<br> <br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Public Shared Function</font> GetFeaturedAd() <font color="#0000ff"> As</font> DataTable<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Dim</font> table <font color="#0000ff">As</font> AdsDataComponent.AdsDataTable = AdsDB.GetFeaturedAdsSelection(3)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Return</font> table<br> &nbsp;&nbsp;&nbsp;<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; End Function</font><br> <br> <br> And in the control FeaturedAd.ascx I changed everything that said AdID with Id.<br> <br> That made my 3 ads show up. <br> </p> <blockquote></blockquote> <p></p> <p>---------------------------------------------------------------------------------------------------------</p> <p>Hello Can any one come ahead with an exact solution to make this work.<br> <br> I do not understand how to make this work as&nbsp; per the code mentioned above. Does it really work or thiere is a bug within.<br> <br> Since this was before the Final Kit, i believe, there should be an exact solution by now.<br> <br> Help us out.<br> <br> Thanks<br> </p> 2006-09-13T05:49:24-04:001397658http://forums.asp.net/p/1001971/1397658.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? One other thing to note is that an entry will only display/work if the advert has a photo. 2006-09-13T10:12:03-04:001619567http://forums.asp.net/p/1001971/1619567.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? Any working solution with a VB code.<br> <br> I still cannot show 3 featured ads on the front page.<br> <br> I would appreciate, if some one can help[ me out with a working solution with cache in VB.NET.<br> <br> Thanks<br> 2007-03-14T07:46:14-04:001809521http://forums.asp.net/p/1001971/1809521.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>&nbsp;</p> What changes are required to&nbsp;CSS to show 3 ads horizontally. I have added <font color="#a31515" size="2"> <p>#featured_item</p> </font><font size="2"> <p>{</p> </font><font color="#ff0000" size="2">float</font><font size="2">: </font><font color="#0000ff" size="2">left</font><font size="2">;</font><font size="2"> <p></font>...</p> <p>&nbsp;}</p> <p>But that makes next section to follow the featured ads...&nbsp;</p> 2007-07-18T07:18:18-04:001821499http://forums.asp.net/p/1001971/1821499.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>Where is located that function you are talking about?</p> <p>thanks&nbsp;</p> 2007-07-24T23:41:05-04:001827342http://forums.asp.net/p/1001971/1827342.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>Public Shared Function GetFeaturedAd() As DataTable Dim table As AdsDataComponent.AdsDataTable = AdsDB.GetFeaturedAdsSelection(3) Return table End Function i would like to know exactly where to put this in the file, ine the vb file or the aspx file, and where, thank you for your advice and help </p> 2007-07-27T14:29:20-04:001827347http://forums.asp.net/p/1001971/1827347.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>Public Shared Function GetFeaturedAd() As DataTable Dim table As AdsDataComponent.AdsDataTable = AdsDB.GetFeaturedAdsSelection(3) Return table End Function i would like to know exactly where to put this in the file, ine the vb file or the aspx file, and where, thank you for your advice and help </p> 2007-07-27T14:31:07-04:001831358http://forums.asp.net/p/1001971/1831358.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p></p> <blockquote><span class="icon-blockquote"></span> <h4>jherch77</h4> Well, I figured out what seems to be the easiest solution to this...albeit not the best.&nbsp; I changed the following function to what is below:<br> <br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Public Shared Function</font> GetFeaturedAd() <font color="#0000ff"> As</font> DataTable<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Dim</font> table <font color="#0000ff">As</font> AdsDataComponent.AdsDataTable = AdsDB.GetFeaturedAdsSelection(3)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#0000ff">Return</font> table<br> &nbsp;&nbsp;&nbsp;<font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; End Function</font><br> <br> <br> And in the control FeaturedAd.ascx I changed everything that said AdID with Id.<br> <br> That made my 3 ads show up. <br> </blockquote> &nbsp; <p></p> <p>In which file can I find this function?&nbsp; Thanks.</p> 2007-07-30T20:09:21-04:001831737http://forums.asp.net/p/1001971/1831737.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>&nbsp;</p> <p>This solution is not the best, yet it works. It would be nice if somebody would show the complete cached code....</p> <p>&nbsp;Here is the quick and dirty solution for now. This is in Ads.cs (appdata folder)</p> <p>&nbsp;</p> <font size="2"></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">static</font><font size="2"> </font><font color="#2b91af" size="2">AdsDataComponent</font><font size="2">.</font><font color="#2b91af" size="2">AdsDataTable</font><font size="2"> GetFeaturedAdsSelection(</font><font color="#0000ff" size="2">int</font><font size="2"> maxNumAds)</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (maxNumAds &lt; 1)</font><font size="2"> <p></font><font color="#0000ff" size="2">return</font><font size="2"> </font><font color="#0000ff" size="2">null</font><font size="2">;</p> </font><font color="#0000ff" size="2">using</font><font size="2"> (</font><font color="#2b91af" size="2">AdsDataAdapter</font><font size="2"> db = </font><font color="#0000ff" size="2">new</font><font size="2"> </font><font color="#2b91af" size="2">AdsDataAdapter</font><font size="2">())</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">return</font><font size="2"> db.GetAdsByRandomOrder(maxNumAds, (</font><font color="#0000ff" size="2">int</font><font size="2">)</font><font color="#2b91af" size="2">AdStatus</font><font size="2">.Activated, (</font><font color="#0000ff" size="2">int</font><font size="2">)</font><font color="#2b91af" size="2">AdLevel</font><font size="2">.Featured);</font><font size="2"> <p>}</p> <p>}</p> <p></font>&nbsp;here is your featured.ascx page:</p> <font color="#0000ff" size="2"> <p>&lt;</font><font color="#a31515" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#a31515" size="2">ObjectDataSource</font><font size="2"> </font><font color="#ff0000" size="2">ID</font><font color="#0000ff" size="2">=&quot;FeaturedAdDataSource&quot;</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">TypeName</font><font color="#0000ff" size="2">=&quot;AspNet.StarterKits.Classifieds.BusinessLogicLayer.AdsDB&quot;</p> </font><font size="2"> <p></font><font color="#ff0000" size="2">SelectMethod</font><font color="#0000ff" size="2">=&quot;GetFeaturedAdsSelection&quot;</font><font size="2"> </font><font color="#ff0000" size="2">OnSelected</font><font color="#0000ff" size="2">=&quot;FeaturedAdDataSource_Selected&quot;&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#a31515" size="2">SelectParameters</font><font color="#0000ff" size="2">&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#a31515" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#a31515" size="2">Parameter</font><font size="2"> </font><font color="#ff0000" size="2">Type</font><font color="#0000ff" size="2">=&quot;Int32&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Name</font><font color="#0000ff" size="2">=&quot;maxNumAds&quot;</font><font size="2"> </font><font color="#ff0000" size="2">DefaultValue</font><font color="#0000ff" size="2">=&quot;3&quot;</font><font size="2"> </font><font color="#0000ff" size="2">/&gt;</p> </font><font size="2"> <p>&nbsp;</p> <p></font><font color="#0000ff" size="2">&lt;/</font><font color="#a31515" size="2">SelectParameters</font><font color="#0000ff" size="2">&gt;</p> </font> 2007-07-31T02:27:23-04:001831739http://forums.asp.net/p/1001971/1831739.aspx/1?Re+Only+one+featured+add+Re: Only one featured add? <p>The problem with thsi solution is that you are bypassing cache code, so please somebody provide the complete C# cache code for us:)</p> <p>&nbsp;Otherwise i am going to write it :) Hope somebody will save my time :)</p> 2007-07-31T02:30:40-04:00