Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2012, 01:45 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile use shortcode to display survey

Hi Imar,
survey engine is really good but it is displayed only on front page. To show it in some other page we need to use the same code in that other page. But still only
one survey can be visible.
Is it possible to access the survey through short codes (I do not know it might be called something else) like [survey id=1] [survey id=2] etc...
where survey is to show that we are calling survey and Id tells which survey to load.

If yes then how this can be done.

Thanks...
 
Old January 11th, 2012, 02:27 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I didn't write that chapter, so I don't know how the survey works.

My guess would be to look at the code that loads the current survey for the homepage, and see if you can parameterize that to query one by its ID.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 11th, 2012, 04:40 PM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Thanks, I will look and try to make things work but chances are very few.

But can you give general idea for this type of data binding that I asked in question. We actually use this type of code while defining web services like this [WebMethod]. So how we can let application know that what [xyz] means.

Or can you tell regarding any other application that you wrote e.g. assume I want to show a particular product from WroxShop like this
[Shop Id=1]

Now it must show a product with id=1 to the end user...
 
Old January 11th, 2012, 05:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It's a matter of executing a SQL query with the ID in the WHERE clause somehow. E.g:

SELECT Whatever FROM SomeTable WHERE Id = 123

How you do this depends on the data access technology you're using.

Quote:
But can you give general idea for this type of data binding that I asked in question. We actually use this type of code while defining web services like this [WebMethod]. So how we can let application know that what [xyz] means.
I am not sure what this means, or what you're asking. [WebMethod] is an attribute, somewhat like a label you attach to code. I don't see how this could be used to query surveys from a database. For more information about attributes:
http://www.dotnetattributes.com/
http://www.dotnetattributes.com/Faqs/

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 12th, 2012, 02:48 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Hi Imar,
Links you posted are really informative for me as I was not aware to such stuff before, thanks for this.

Ok I am trying my best to explain my problem.
We use tags whether it is server side or ordinary html. e.g. <img>
Here whenever <img> tag is found application knows that it is required to show an image which is located at the address which is specified by its src attribute.

Code:
<img src="url">
for this we have not written any custom code to let application know that it is image. However for our own custom tags it might be required. (I do not know)

Similarly I am trying to display information using such code. Here I am using square brackets (not mandatory, I can use angle brackets as well)
so [Shop id=1] will infer to to display shop product having id = 1.
As we can use img tag anywhere (even in html editor) same I wanna show shop product anywhere using shop tag.

it might be wrapped in either square brackets or angle bracket.
I hope I tried best to explain my problem.

Thanks
 
Old January 12th, 2012, 03:08 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Why would you want this? Why not simply use, say, the Query String to pass an ID to the code that selects a survey?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 12th, 2012, 05:05 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Actually there might be few areas, where this may be required. Not going specific to surveys, let's assume that in blog application one wants to sell few ebooks on different blogs, and keeps different prices for these. Now user just wants that he should be able to display a book and a paypal button with a price by that sample tag that I talked about that is just specify

Code:
[paypal productname:abc price:$$]
or [paypal productname="abc" price="$$"]
analogy to img tag.
All the paypal core settings viz. account type, paypal id be stored in different table in blog application.

However he can embed code for this but he does not want to use that all script again and again in between while writing the blog.

This is something like this, it is not however actual scenario that I currently need but I am just trying to make understand what I need.

So kindly tell me how such thing can be managed?

Thanks...
 
Old January 12th, 2012, 11:31 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I still don't understand what you want, or why you'd want it.Maybe User Controls or Custom Server Controls are the solution....

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 12th, 2012, 12:06 PM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Code:
Maybe User Controls or Custom Server Controls are the solution...
This might be definitely a solution, but I would not like to use runat or Id attributes....

But how I make you understand (perhaps I am worst writer).
what would you suggest an admin to use

a.) use the full data access code to show a single record from database something like

Code:
<asp:Label runat="server" ID="Label1" Text='<%# Eval ("Description")%>'></Label>
which will show only description, based on Id which might come from
querystring.

or b.) just use some code like
Code:
[shop Id=1]
which may show the complete detail of product whose Id is 1.

Last edited by sophia; January 12th, 2012 at 12:13 PM..
 
Old January 12th, 2012, 01:52 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

And how is an admin going to manage that content? By managing the ASPX files directly? Storing content in a database is going to way easier....

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Survey Engine Dennis239 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 6 March 3rd, 2008 02:34 PM
Language survey jminatel Perl 0 August 28th, 2007 09:50 PM
Language survey jminatel Python 0 August 28th, 2007 09:49 PM
Language Survey jminatel Beginning PHP 0 August 28th, 2007 09:48 PM
Survey engine anitafn2005 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 October 8th, 2006 04:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.