 Rank: Member
Joined: 3/5/2010(UTC) Posts: 24
|
How I can create a marquee tag in ASP.Net that gets data from a database … (Marquee: it is a moving text and is normally used as an HTML tag).
My requirement is to show the marquee as an hyperlink whihc shows up the current month as text.
|
|
|
|
|
|
|
|
|
|
 Rank: Administration
Joined: 1/9/2010(UTC) Posts: 449  Location: India Was thanked: 1 time(s) in 1 post(s)
|
You can use the following method.
HTML code: <asp:Literal ID="Literal1" runat="server"></asp:Literal>
Then you can give value for the literal in code behind (C#).
protected void Page_Load(object sender, EventArgs e) { string str = "get data from database"; string text = "<MARQUEE>" + str + "</MARQUEE>"; Literal1.Text = text; }
Hope it helps.
|
|
|
|
|
|
 Rank: Guest
Joined: 12/12/2009(UTC) Posts: 540
|
soan ur method is good but wat if i have to choose the direction of marquee as up?
|
|
|
|
|
|
 Rank: Guest
Joined: 12/12/2009(UTC) Posts: 540
|
but how should we increase the space for that moving marquee
|
|
|
|
|
|
 Rank: Guest
Joined: 12/12/2009(UTC) Posts: 540
|
string str = "Tejashri"; string text = "<Marquee direction='Up'>" + str + "</Marquee>"; Literal1.Text = text;
|
|
|
|
|
|
 Rank: Guest
Joined: 12/12/2009(UTC) Posts: 540
|
Sir, I need multiple text which are displayed one after another. So, should I need another string or what else?
Thanks and regards Ranjit Dutta.
|
|
|
|
|
|
 Rank: Administration
Joined: 1/9/2010(UTC) Posts: 449  Location: India Was thanked: 1 time(s) in 1 post(s)
|
Yes Ranjit, you can try multiple strings to get the effect for multiple string. Or if all the strings are pointing to same hyperlink, you can include it in single marquee tag.
|
|
|
|
|
|
 Rank: Guest
Joined: 12/12/2009(UTC) Posts: 540
|
sir how to data fetch from database in string format ? in same question
|
|
|
|
|
|
 Rank: Administration
Joined: 1/9/2010(UTC) Posts: 449  Location: India Was thanked: 1 time(s) in 1 post(s)
|
Originally Posted by: Guest  sir how to data fetch from database in string format ? in same question
You need to use any DB control like SQLdatasource and then place your DB table query. Once the query runs and returns the string, you can pretty well use it in the Marquee tag. Share you code and then i can help you with exact code.
|
|
|
|
|
|
 Rank: Guest
Joined: 12/12/2009(UTC) Posts: 540
|
Hi,
i need to change the marque text when clicking next & previous button is it possible?
Regards,
Vinothini. D
|
|
|
|
|
|
 Rank: Administration
Joined: 1/9/2010(UTC) Posts: 449  Location: India Was thanked: 1 time(s) in 1 post(s)
|
Originally Posted by: Guest  Hi,
i need to change the marque text when clicking next & previous button is it possible?
Regards,
Vinothini. D
Yes, It is possible. Just change the value of variable 'str' in above code on the click of your previous and next buttons. It should work. Let me know if you need more information.
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.