how to give marquee to a hyperlink in repeater control - asp.net

I want to show some scrolling(marquee) link in my Website form to
display data I am using repeater control.but when i am trying to give
marquee to the repeater it doesn't give me output How I give marquee
Please help. My code:
<div id="calendar1">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CBMIAConnectionString %>"
SelectCommand="SELECT Event FROM [Home_EventLink]"></asp:SqlDataSource>
<table id="Head_Meeting">
<tr>
<td style="font-size: large; font-weight: bold; font-family: Arial, Helvetica, sans-serif; text-transform: capitalize; color: white;">&nbsp&nbsp<i class="fas fa-calendar-alt" style="font-size: 25px; color: white"></i>&nbsp Upcoming Meetings</td>
</tr>
</table>
<br />
<div id="Meeting_Event" padding-left="5px" padding-right="5px">
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" class="hyperlink" Text='<%# Eval("Event") %>' href="home.aspx" runat="server" /><br />
</ItemTemplate>
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:Repeater>
</div>
</div>

THIS MAY HELP
<marquee id="MyMovingText" style="width: 80%" scrollamount="5" onmouseover="stop();" onmouseout="start();" runat="server" direction="left">
<asp:datalist RepeatDirection="Horizontal" ID="rptbreaknews" runat="server">
<ItemTemplate>
<a class="readmore" target="_blank" href='<%#"details.aspx?Id="+Eval("Id") %>'>
<h3><asp:Label ID="lbltext" Text='<%#Eval("NewNewsTitle") %>' runat="server"></asp:Label></h3>
</a>
</ItemTemplate>
</asp:datalist>
</marquee>

You can use marquee like this. And do not use class and href within an aspnet Control but use the correct properties like CssClass and NavigateUrl
<marquee id="MyMovingText" direction="left" scrollamount="10">
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<div class="scroll-item">
<asp:HyperLink ID="HyperLink1" CssClass="hyperlink" Text='<%# Eval("Event") %>'
NavigateUrl="/home.aspx" runat="server" />
</div>
</ItemTemplate>
</asp:Repeater>
</marquee>
<style>
.scroll-item {
float: left;
margin-right: 50px;
}
</style>

Related

ItemTemplate in Listview - Layout issue

I have the following Listview in my aspx page
<asp:ListView ID="ListView1" GroupItemCount="4" runat="server"
DataKeyNames="contentid" DataSourceID="sqldsPhotos">
<LayoutTemplate>
<asp:Placeholder
id="groupPlaceholder"
runat="server" />
</LayoutTemplate>
<GroupTemplate>
<div>
<asp:Placeholder
id="itemPlaceholder"
runat="server" />
</div>
</GroupTemplate>
<ItemTemplate>
<asp:Image id="picAlbum" runat="server"
ImageUrl='<%# "ShowImage.ashx?id=" + Convert.ToString(Eval("contentid")) %>'
Height="108" Width="192" />
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
<EmptyItemTemplate>
</EmptyItemTemplate>
</asp:ListView>
The resulting webpage displays my image with the link button beside it. What I would like is the image with the Linkbutton centered below it for each item.
Can someone help me out with the necessary html or css to achieve this.
Try the following html inside ItemTemplate
<div style="float: left; margin-left: 10px; text-align:center;width: 192; ">
<asp:Image id="picAlbum" runat="server"
ImageUrl='<%# "ShowImage.ashx?id=" + Convert.ToString(Eval("contentid")) %>'
Height="108" Width="192" />
<asp:LinkButton ID="LinkButton1" runat="server"
style="display: block; clear: both;">LinkButton</asp:LinkButton>
</div>
The above code will show divs side by side. So inorder to show 4 divs add with (800px) to your items in list view.
If you don't get the linkbutton at center add some margin-left to it to show it at center.
Try this:
<div style="width: 192px; text-align:center;">
<asp:Image id="picAlbum" runat="server"
ImageUrl='<%# "ShowImage.ashx?id=" + Convert.ToString(Eval("contentid")) %>'
Height="108" Width="192" /><br/>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
</div>

Divs not working as expected

I am trying to create the rows of controls. Basically it is for filtering a search. There are six controls in each row, 3 labels and 3 dropdownlists/textboxes. I have a div which creates rows and the first row turns out great but the rest is really weird.
The markup is the following
<div class="fullRow" style="margin-top:10px">
<asp:Label ID="FilterDepartmentLabel" AssociatedControlID="FilterDepartment" runat="server" Text="Department" CssClass="aThirdLabel"></asp:Label>
<asp:DropDownList ID="FilterDepartment" runat="server" CssClass="aThirdInput" />
<asp:Label ID="FilterCardStatusLabel" AssociatedControlID="FilterCardStatus" runat="server" Text="Status" CssClass="aThirdLabel"></asp:Label>
<asp:DropDownList ID="FilterCardStatus" runat="server" CssClass="aThirdInput" />
<asp:Label ID="FilterCardBehaviorLabel" AssociatedControlID="FilterCardBehavior" runat="server" Text="Behavior" CssClass="aThirdLabel"></asp:Label>
<asp:DropDownList ID="FilterCardBehavior" runat="server" CssClass="aThirdInput" />
</div>
<div class="fullRow" style="margin-top:10px">
<asp:Label ID="FilterCarPlateLabel" AssociatedControlID="FilterCarPlate" runat="server" Text="Car Plate" CssClass="aThirdLabel"></asp:Label>
<asp:TextBox ID="FilterCarPlate" runat="server" CssClass="aThirdInput"></asp:TextBox>
<asp:Label ID="FilterCardNoLabel" AssociatedControlID="FilterCardNo" runat="server" Text="Car No" CssClass="aThirdLabel"></asp:Label>
<asp:TextBox ID="FilterCardNo" runat="server" CssClass="aThirdInput"></asp:TextBox>
<asp:Label ID="FilterRuleSetCodeLabel" AssociatedControlID="FilterRuleSetCode" runat="server" Text="Rule Set" CssClass="aThirdLabel"></asp:Label>
<asp:DropDownList ID="FilterRuleSetCode" runat="server" CssClass="aThirdInput" />
</div>
<div class="fullRow" style="margin-top:10px">
<asp:Label ID="FilterDriverLastNameLabel" AssociatedControlID="FilterDriverLastName" runat="server" Text="Driver Lastname" CssClass="aThirdLabel"></asp:Label>
<asp:TextBox ID="FilterDriverLastName" runat="server" CssClass="aThirdInput"></asp:TextBox>
<asp:Label ID="FilterCardTypeLabel" AssociatedControlID="FilterCardType" runat="server" Text="Type" CssClass="aThirdLabel"></asp:Label>
<asp:DropDownList ID="FilterCardType" runat="server" CssClass="aThirdInput" />
</div>
And here is the css
.fullRow
{
width: 100%;
display:block;
}
.aThirdLabel
{
width: 15%;
float: left;
font-size:small;
height: 22px;
}
.aThirdInput
{
width: 15%;
float: left;
}
Actually, even though this looks good in design view of VS2010, when its loaded in the browser, its a mess.
Thanks
EDIT: The answer is in the comment huMpty duMpty made.
Add <div style="clear:both;"></div> after each row.

How to align objects vertically in ASP.NET?

I have been messing around with asp.net for awhile now and always have issues aligning objects with various heights on the same row. For example, in this case, I have a search label, a text field, then a image button. What is the "proper way" to get these three items to align properly?
My existing code:
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:Panel VerticalAlign="Center" runat="server">
<asp:Label ID="Label1" runat="server" Font-Size="X-Large" Text="Search Tests:"></asp:Label>
<asp:TextBox ID="searchTextBox" runat="server" Font-Size="X-Large"
Height="30px" style="margin-left: 13px; margin-top: 0px" Width="219px"></asp:TextBox>
<asp:ImageButton ID="ImageButton2" runat="server" Height="45px"
ImageUrl="~/Images/SearchButton.PNG" style="margin-left: 18px; margin-top: 0px"
Width="95px" />
</asp:Panel>
</asp:Content>
The easiest is using CSS or tables. I put a div around with a height and vertical align to the top. CSS Reference
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:Panel ID="Panel1" VerticalAlign="Center" runat="server">
<div style="height: 40px; vertical-align: top">
<div style="padding-top: 10px; float:left;">
<asp:Label ID="Label1" runat="server" Font-Size="X-Large" Text="Search Tests:"></asp:Label>
</div>
<div style="padding-top: 5px; float:left;">
<asp:TextBox ID="searchTextBox" runat="server" Font-Size="X-Large" Height="30px"
Style="margin-left: 13px; margin-top: 0px" Width="219px"></asp:TextBox>
</div>
<div style="padding-top: 5px; float:left;">
<asp:ImageButton ID="ImageButton2" runat="server" Height="45px" ImageUrl="~/Images/SearchButton.PNG"
Style="margin-left: 18px; margin-top: 0px" Width="95px" />
</div>
</div>
</asp:Panel>
</asp:Content>
i had the same problem and i think that using a table or a div only to align the Textbox it's excessive.
I solved simply:
<asp:TextBox ID="TextBox2" runat="server" Width="60px"></asp:TextBox>
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/imatges/imgNou.png"
CssClass="style3" ImageAlign="AbsBottom" />
And adding the margin-top in Design view, the IDE added:
.style3
{
margin-top: 6px;
}

How to make a Faq page like this in Asp.net

I would like to make a FAQ page similar to here: Forum FAQ
using an sql database. Does anyone have any ideas?
create table faq_questions and add there questions,
table structure:
categorie, question, answer
and the read that data to website, what programming language you are using?
this is the final answer for my own question. Here it is it
<asp:Repeater id="faqCategoryList" runat="server">
<HeaderTemplate>
<h4>
Frequently Asked Questions</h4>
</HeaderTemplate>
<ItemTemplate>
<a href='#<%# Eval("FAQCategoryCode")%>' class="lnkButton">
<%# Eval("CategoryName")%>
</a>
</ItemTemplate>
<SeparatorTemplate>
<hr class="dashed" />
</SeparatorTemplate>
<FooterTemplate>
<div style="margin-bottom: 30px;">
</div>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<fieldset id='<%# ((System.Data.DataRowView)Container.DataItem)["FAQCategoryCode"]%>'>
<legend><span style="font-size: medium; font-weight: bold;">
<%# ((System.Data.DataRowView)Container.DataItem)["CategoryName"]%>
</span></b> </legend>
<asp:Repeater id="Repeater2" datasource='<%# ((System.Data.DataRowView)Container.DataItem).CreateChildView("FaqRelation")%>'
runat="server">
<ItemTemplate>
<div style="font-weight: bold;">
<%# ((System.Data.DataRowView)Container.DataItem)["Question"]%>
</div>
<br />
<%#((System.Data.DataRowView)Container.DataItem)["Answer"]%>
<br />
<br />
</ItemTemplate>
<SeparatorTemplate>
<hr class="dashed" />
</SeparatorTemplate>
<FooterTemplate>
<a href="javascript:scroll(0,0)" style="float: right">
<img src="Images/png/icon_back_top.gif" class="lnkButton" alt="top" />Top</a>
</FooterTemplate>
</asp:Repeater>
</fieldset>
</ItemTemplate>
<FooterTemplate>
<br />
</FooterTemplate>
</asp:Repeater>

asp.net profiles

I have this page called profile. The time is wrong when I run the application. Can someone help me correct the time to the right format?
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<strong>To View Profiles You Have to Register Or </strong> <asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/Account/Login.aspx" Font-Size="Large" Font-Bold="True">Login</asp:HyperLink>
</AnonymousTemplate>
<LoggedInTemplate>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [UserId], [UserName], [LastActivityDate] FROM [vw_aspnet_Users]"></asp:SqlDataSource><br />
<div align="center">
<h1 style="text-align:center;
font-size: x-large;
font-weight: bold;
border: solid 2px gold;
background-color: #ffc;
padding: 5px;
margin-bottom: 15px;
width: 66%;">
Members Of Living To Please The Lord World(Ephesians 5:10) !
</h1>
</div><br />
<div style="padding-left:10px" align="center">
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<a id="A1" href=<%#"~/Profiles.aspx?UserId=" & Eval("UserId").ToString %> runat="server" style="font-size:large;">
<%#Eval("UserName") %>
</a>
Last Visted On : <%# Eval("LastActivityDate")%>
<br />
</ItemTemplate>
</asp:Repeater>
</div>
</LoggedInTemplate>
</asp:LoginView>
Ok, if this is really MVC, it should look like this: <%= Model.LastActivityDate.ToShortDateString() %> But I think you have ASP.NET Forms here.

Resources