ASP NET LinkButton - Inner Controls Removed - asp.net

We have the follow repeater construct on our home page:
<asp:Repeater runat="server" ID="repShortcuts" OnItemDataBound="repShortcuts_ItemDataBound">
<ItemTemplate>
<asp:LinkButton runat="server" ID="lnkShortcut" PostBackUrl='<%# Eval("LinkWithTab") %>' Text="" ViewStateMode="Enabled" Style="text-decoration: none;">
<div style="margin-left: 2px; margin-right: 2px; height: 90px; display: inline-block; white-space: normal; text-align: center; vertical-align: top;">
<asp:Image
runat="server"
ID="imgShortcut"
ImageUrl='<%# String.Format("./Icons/{0}{1}",Session["DetailsBoxTextColour"].ToString().ToLower() == "black" ? "d" : "", Eval("ParentIcon")) %>'
CssClass="MenuImage"
Style="margin-bottom: 0px;"
/>
<asp:Label
runat="server"
ID="lblShortcut"
Text='<%# Eval("DisplayName") %>'
CssClass="MenuText"
Style="font-size: small; overflow: hidden; width: 110px; white-space: pre-line; text-wrap: normal; display: inline-block;"
></asp:Label>
</div>
</asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblEmptyData" runat="server" CssClass="DetailsBoxSettingLabel MarginTop5" Text="You currently have no shortcuts." Visible="false" />
</FooterTemplate>
</asp:Repeater>
When viewing the page (GET):
On server A (live) the inner controls are rendered as expected (this is an image and some text). Also works on all our dev machines.
On server B (uat) and some user machines which have the application installed, the inner controls are removed and we are just left with the anchor tag for the linkbutton.
This seems to be related to Microsoft Connect issue 718810 which is nowhere to be found now. Completely lost as to what's going on here. Same code, same server setup essentially.

Related

how to give marquee to a hyperlink in repeater control

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>

My border is only bordering the H2 element in my div [duplicate]

This question already has answers here:
Floating elements causes the parent to collapse. HTML / CSS
(2 answers)
Closed 7 years ago.
This is the code from my asp.net application, and below is the CSS I have so far.
The problem I'm having is that the border I have is only covering the H2 element in my application. What I want is for the border to cover everything within the "persInfo" div, but it's not doing this and I cannot figure out why.
When I use "split" in Visual Studio it shows the border covering everything, but when I run it, it's only covering the H2 element.
#persInfo {
border: 3px solid;
border-radius: 25px;
}
#lblWrapper {
width: 50%;
float: left;
}
#tbxWrapper {
width: 50%;
float: right;
}
.lbl {
display: block;
margin-top: 9px;
margin-left: 20px;
}
.tbx {
display: block;
margin-top: 6px;
}
<div id="persInfo">
<h2>Personal Information</h2>
<div id="lblWrapper">
<asp:Label ID="Label7" runat="server" Text="First name" CssClass="lbl"></asp:Label>
<asp:Label ID="Label2" runat="server" Text="Surname" CssClass="lbl"></asp:Label>
<asp:Label ID="Label3" runat="server" Text="Email" CssClass="lbl"></asp:Label>
<asp:Label ID="Label4" runat="server" Text="Confirm Email" CssClass="lbl"></asp:Label>
<asp:Label ID="Label5" runat="server" Text="Password" CssClass="lbl"></asp:Label>
<asp:Label ID="Label6" runat="server" Text="Confirm Password" CssClass="lbl"></asp:Label>
</div>
<div id="tbxWrapper">
<asp:TextBox ID="tbxFname" runat="server" CssClass="tbx"></asp:TextBox>
<asp:TextBox ID="tbxSname" runat="server" CssClass="tbx"></asp:TextBox>
<asp:TextBox ID="tbxEmail" runat="server" CssClass="tbx"></asp:TextBox>
<asp:TextBox ID="tbxEmail2" runat="server" CssClass="tbx"></asp:TextBox>
<asp:TextBox ID="tbxPass" runat="server" CssClass="tbx"></asp:TextBox>
<asp:TextBox ID="tbxPass2" runat="server" CssClass="tbx"></asp:TextBox>
</div>
</div>
Elements that only contain floated elements will collapse.
You will need to "clear" the floats.
For a variety of so-called "clearfix" options, see this Question

How to fix issue with required field validator

I inserted a required field validator in my inserttemplate of my listview. The validator is suppose to check if a value was selected in the listbox when a user clicks insert. It does what is suppose to do however, I have a search button outside the listview that displays the listview columns and when that is clicked the required field validator is triggered. I only want it to trigger when the insert button is clicked within the listview. Is this possible?
Search Button located in ContentTemplate
<div style="padding-top: 5em; text-align: center; margin-left: auto; margin-right: auto; left: 0; right: 0; width:100%">
<b style="padding-right: .5em">FormSection </b>
<asp:TextBox ID="SectionSearchBox" runat="server"></asp:TextBox>
<b style="padding-left: 1em; padding-right: .5em">SubSection</b>
<asp:TextBox ID="SubSectionSearchBox" runat="server"></asp:TextBox>
<b style="padding-left: 1em; padding-right: .5em">Section Item</b>
<asp:TextBox ID="SectionItemSearchBox" runat="server"></asp:TextBox>
<asp:Button ID="SearchButton" Height="30px" runat="server" Text="Search" OnClick="SearchButton_Click" />
</div>
Required Field Validator located in content template in the listview's insert template
<span style="color:red">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Required Field!" ControlToValidate="formsection"></asp:RequiredFieldValidator>
</span>
<div style="height: auto; width: 250px; overflow: auto; border: solid; border-color: ActiveBorder" >
<asp:ListBox ID="formsection" runat="server" DataSourceID="FormSectionDataSource" DataTextField="FormSection" DataValueField="FormSectionID" AppendDataBoundItems="True" SelectedValue='<%# Bind("FormSectionID") %>' Height="150px">
<asp:ListItem Selected="True" Value=""><- please select -></asp:ListItem>
</asp:ListBox>
</div>
I figured it out, in the code behind I used.
SearchButton.CausesValidation = false;
When the button is clicked it does not trigger the validation.

asp.NET CSS Issue on Post Back

We are currently developing an asp.NET 4.0 Web Forms application. In a particular screen we attempted to create a grid view with a fixed header and footer. We got this working how we wanted, but then we realised that when we click a button which issues a partial post back (triggers required field validators for example) the fixed header disappears.
Any ideas why this is happening?
Code as follows:
CSS (relevant parts):
.tableStyle
{
}
.tableStyle th
{
text-align: left !important;
padding: 2px 5px !important;
font-weight: bold;
}
.tableStyle td
{
padding: 1px 5px !important;
text-align: left;
}
.container
{
overflow-y: scroll;
overflow-x: hidden;
height: 500px;
}
.container table tbody
{
overflow-x: hidden;
}
/* Creates a Scrollable Div */
.GridViewContainer
{
overflow: auto;
}
.freezeHeader
{
position: absolute;
background-color: White;
font-weight: bold;
margin-top: -40px;
padding-bottom: 5px;
z-index: 99;
}
.freezeFooter
{
position: absolute;
background-color: White;
top: 530px;
padding-bottom: 20px;
z-index: 95;
}
.paddingTop
{
margin-top: 40px;
}
ASPX Page (Grid View Part):
<fieldset>
<legend>Products Mapping Table (EXT_CFG_PDT_MAP)</legend>
<div id="grdWithScroll" class="container">
<asp:GridView
ID="ProductsMappingTableGridView"
AutoGenerateColumns="false"
runat="server"
OnRowCancelingEdit="ProductsMappingTableGridView_RowCancelingEdit"
OnRowEditing="ProductsMappingTableGridView_RowEditing"
OnRowUpdating="ProductsMappingTableGridView_RowUpdating"
ShowFooter="true"
OnRowCommand="ProductsMappingTableGridView_RowCommand"
CssClass="tableStyle paddingTop"
HeaderStyle-CssClass="freezeHeader"
FooterStyle-CssClass="freezeFooter">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="editButton" Text="Edit" CausesValidation="false" CommandName="Edit" runat="server" Enabled='<%# Session["ProductsMappingsWriteAccess"] %>'/>
</ItemTemplate>
<EditItemTemplate>
<asp:Button ID="updateButton" Text="Update" CommandName="Update" runat="server" ValidationGroup="Edit"/>
<asp:Button ID="cancelButton" Text="Cancel" CausesValidation="false" CommandName="Cancel" runat="server" />
</EditItemTemplate>
<FooterTemplate>
<asp:Button ID="insertButton" Text="Insert" CommandName="Insert" runat="server" ValidationGroup="Insert" Enabled='<%# Session["ProductsMappingsWriteAccess"] %>'/>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Product Mapping ID</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="mptIdLabel" runat="server" Text='<%# Eval("MPT_ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Source Key</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="srcKeyLabel" runat="server" Text='<%# Eval("SRC_KEY") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList AutoPostBack="false" ID="srcKeyListEdit" runat="server" Width="95px" OnLoad="SrcKeyListInitalization" >
</asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList AutoPostBack="false" ID="srcKeyListInsert" runat="server" Width="95px" OnLoad="SrcKeyListInitalization"
Visible='<%# Session["ProductsMappingsWriteAccess"] %>'>
</asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Product Key - Source</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="pdtKeySrcLabel" runat="server" Text='<%# Eval("PDT_KEY_SRC") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="pdtKeySrcTextBoxEdit" runat="server" Text='<%# Eval("PDT_SRC") %>'
MaxLength="32"></asp:TextBox>
<br />
<asp:RequiredFieldValidator runat="server" ID="pdtKeySrcTextBoxEditRequiredFieldValidator"
ControlToValidate="pdtKeySrcTextBoxEdit" ValidationGroup="Edit" ForeColor="Red"
ErrorMessage="PDT_KEY_SRC is required"></asp:RequiredFieldValidator>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="pdtKeySrcTextBoxInsert" runat="server" Text='<%# Eval("KEY_SRC") %>'
MaxLength="32" Visible='<%# Session["ProductsMappingsWriteAccess"] %>'></asp:TextBox>
<br />
<asp:RequiredFieldValidator runat="server" ID="pdtKeySrcTextBoxInsertRequiredFieldValidator"
ControlToValidate="pdtKeySrcTextBoxInsert" ValidationGroup="Insert" ForeColor="Red"
ErrorMessage="PDT_KEY_SRC is required"></asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</fieldset>
Update 1: I would like to point out that this appears not to have been affected on IE 8 but it was affected when I used IE 10.
A hotfix is available for the ASP.NET browser definition files in the Microsoft .NET
please refer http://support.microsoft.com/kb/2600088 for .NET 4.0
Refer http://support.microsoft.com/kb/2608565 for .Net 3.5

Multiple ASP modal popups on one page

We have a working modal popup on an asp.net page, and need to add another one. A linkbutton opens the first one.
But if we try adding code for another linkbutton to open a second popup, which will use another mp extender control, neither one of them work. If we then remove the second popup and extender code, it works again.
I posted this question before but got an answer about using them in a gridview, which is not what is going on. This issue is not that complicated, just the fact that we can't get two separate popups working on a page. Are there any bugs or anything that would be preventing this from working?
The code below is for the working popup. It seems logical that if we add code that works to a page and give the controls new names, it should work as well, right? Anyway, a little help?
<!--modal popup extender-->
<ajax:ModalPopupExtender ID="mpe1" runat="server"
DropShadow="false"
TargetControlID="btn1"
PopupControlID="mp1"
BehaviorID="ModalPopBehavior"
CancelControlID="btnCancel">
</ajax:ModalPopupExtender>
<!--modal panel-->
<asp:Panel ID="mp1" runat="server" EnableViewState="true" Visible="False" Width="290px" height="140px"
BorderWidth="4px" BorderStyle="Ridge" BorderColor="Control" style="display:none;" >
<asp:Table ID="Table1" runat="server" BorderStyle="None" Width="290px" Height="140px" BackColor="#ffffee">
<asp:TableRow ID="TableRow1" runat="server">
<asp:TableCell ID="TableCell1" runat="server">
<asp:Label ID="lbl1" runat="server" CssClass="PanelLabel"
Style="left: 60px; position: absolute; top: 4px" Text="label1"
ForeColor="#0000C0" />
<asp:Label ID="lbl2" runat="server" CssClass="StdLabel"
Style="left: 6px; position: absolute; top: 30px" Text="label2" />
<asp:TextBox ID="txt1" runat="server" CssClass="StdTextbox"
Style="left: 6px; position: absolute; top: 44px" Width="120px" />
<asp:Label ID="lbl3" runat="server" CssClass="StdLabel"
Style="left: 160px; position: absolute; top: 30px"
Text="label3" />
<asp:TextBox ID="txt2" runat="server" CssClass="StdTextbox"
Style="left: 160px; position: absolute; top: 44px" Width="120px" />
<asp:Button ID="btnOK" runat="server"
Style="font-family: Tahoma; font-size: 11px; color: Navy; left: 60px;
position: absolute; top: 86px" Text="OK" Width="90px" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="50px"
style="font-family: Tahoma; font-size: 11px; color: Navy; top: 86px; left: 170px;
position:absolute;"/>
</asp:TableCell>
</asp:TableRow>
</asp:Table></asp:Panel>
In the page there is also the hidden button for the popup. it looks like this:
<!--hidden button for modal popup -->
<asp:Button ID="btn1" visible="true" runat="server" Style="display: none" Enabled="false" />
ok so the problem was that the behaviorID property for each extender had to be unique. Once I set the behaviorID to the same name as the ID in each extender, they all work. Of course all other controls on all popup objects themselves must also be unique.

Resources