开发者

HTML Snippet Generator - Javascript

开发者 https://www.devze.com 2023-03-17 12:06 出处:网络
I\'m trying to write a system that will produce HTML snippets for users dependant on what they choose from a number of options.

I'm trying to write a system that will produce HTML snippets for users dependant on what they choose from a number of options.

Each user will have a unique ID (already in SQL DB) which links to the options they are allowed to select from.

Does anyone have any ideas how I should go about doing this? The pages are ASP.NET C# but I'd prefer to use HTML, JQuery & Javascript for the UI. However I do need to pull the relevant inf开发者_StackOverflow社区o from SQL.

Thanks for any replies!


No problem using html & jquery for the ui.

You can just create a the basic site layout in asp and take advantage of masterpages to limit duplicating your work with any cross page content.

You can add form controls to the pages in asp but don't use server side controls.

Use the regular html form controls so you don't get any post back on user input.

Server side controls will look like this:

<input type=text runat=server ...

the "runat=server" in the tag will cause a post back on the server. Not something you will want if you're planning on using javascript for the ui.

Once your page is set up then you can attach your javascript/jquery to those html form controls and use ajax to query the db to limit the user selections.

With response to your comments:

So if user logs onto system and sees a number of logo and text variations they can download, I would use ajax to query which combinations the user has access to and with that info, dynamically create the download button/link using javascript.

That way no redirect/page refresh etc. is required and the user has a nice interface that you can bling up with jquery.

I'm not sure how you're seeing the user vs sql vs asp required. From my viewpoint:

  1. asp - setup the page.
  2. ajax - pull options user has access to.
  3. javascript - dynamically create the download links.
  4. jquery - make it look nice.

I get using asp if you're extending a system and you kinda have to use it. I've run into that situation way too many times. But if its a new system, I don't see the point of going asp. Never really liked it and probably never will but that just an opinion and shouldn't be taken for much.

  • Good luck


Populate the appropriate HTML content from your database, based on user selection via jQuery AJAX

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号