My boss just saw other company website has a marquee new on the front page, so she asked me if I could make one and arrow her to insert news and the news will dispear at the expired data.
For achieve that task, first I create a table in my database table, here is my table:
then I write a store proceedure, a little tip for fresh guy, alway use store preceedure to insert data for security reasons.
Now, We could start the front end job. I create a user control:marquee.ascx(so you could put it in anyway you like), to display the new, here is my html code:
here is the backcod, I used ado.net to open the database and qurery what I need, and bind it to my BulledtedList:
See the code this if(!IsPostBack) is not neccessary, but I use web froms so it wil inherit maintain state so I don’t need retrieve database everytime postback.
here I am also happy to share the css file for style this unorder list to display inline:
A tip for fresh guy, put this in the page your use control will stand it.
Now, you just need drag the usercontrol to any page you want it with this css style in top of the header it. You coud see it.
Then We could start create a page to arrow my boss to insert the bread news, I used boostrap format so it save my time to write css. here is the front page look like:
here is the html code:
The form use jQury Validate, the jquery-ui.js, is for my boss click then will pop up the jQuery calender to arrow her to put the expired date. So simple isn’t, I am love JQure very much, save a lot of time. It remind me when I first time write javascript over 10 years ago, for every simply function I need write a lot codes.
Finally I just need write a event could be fired by this button.
Ok, That’s all. Have fun!