AJAX :: Tabcontainer Doesn't Show Tabs In Properlly? - asp.net

i am using TabContainer Control of AjaxToolkit for asp.net but when i using it in my project it doesn't shows properly. i googled much but can't find proper solution see below image please help me.
CODE:
<asp:TabContainer ID="TabContainer1" runat="server">
<asp:TabPanel ID="tbpnluser" runat="server">
<HeaderTemplate>
Item Detail</HeaderTemplate>
<ContentTemplate>
<asp:Panel ID="itemDetailGrdPanel" runat="server">
<asp:GridView ID="grdItemDetail" runat="server" AutoGenerateColumns="False" OnRowCreated="gridView_RowCreated"
GridLines="None" OnRowDataBound="gridView_RowDataBound" CellPadding="4" ForeColor="#333333"
AllowPaging="True" PageSize="5" AutoGenerateSelectButton="True" >
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField HeaderText="Item Code" DataField="ItemCode">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="50px" />
</asp:BoundField>
<asp:BoundField HeaderText="Item Description" DataField="ItemDescription">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px" />
</asp:BoundField>
<asp:BoundField HeaderText="Detail" DataField="ItemDetail">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
</asp:BoundField>
<asp:BoundField HeaderText="Quantity" DataField="Quantity">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="100px" />
</asp:BoundField>
</Columns>
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:GridView>
</asp:Panel>
<asp:Panel ID="itemDetailEditPanel" runat="server">
<table align="left" style="width: 187px">
<tr>
<td>
</td>
<td align="left">
Item Code:
</td>
<td>
<asp:TextBox ID="txtItemCode" runat="server" ReadOnly="True"></asp:TextBox>
</td>
<td>
<asp:Button ID="btnFindItemCode" runat="server" Text="Find" />
</td>
</tr>
<tr style="height:70px; vertical-align:top; ">
<td>
</td>
<td >
Item Description:
</td>
<td>
<asp:TextBox ID="txtItemDescription" runat="server" Height="54px"></asp:TextBox>
</td>
</tr>
<tr style=" vertical-align:top; ">
<td>
</td>
<td >
Item Detail:
</td>
<td>
<asp:TextBox ID="txtItemDetail" runat="server" Height="23px"></asp:TextBox>
</td>
</tr>
<tr style=" vertical-align:top; ">
<td>
</td>
<td >
Quantity:
</td>
<td>
<asp:TextBox ID="txtQuantity" runat="server" Height="23px"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="tbpnlusrdetails" runat="server">
<HeaderTemplate>
User Details</HeaderTemplate>
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server">
<table align="center">
<tr>
<td align="right" colspan="2">
</td>
<td>
<b>User Details</b>
</td>
</tr>
<tr>
<td align="right" colspan="2">
UserName:
</td>
<td>
<b>Suresh Dasari</b>
</td>
</tr>
<tr>
<td align="right" colspan="2">
FirstName:
</td>
<td>
<b>Suresh</b>
</td>
</tr>
<tr>
<td align="right" colspan="2">
LastName:
</td>
<td>
<b>Dasari</b>
</td>
</tr>
<tr>
<td align="right" colspan="2">
Email:
</td>
<td>
<b>sureshbabudasari#gmail.com</b>
</td>
</tr>
<tr>
<td align="right" colspan="2">
Phone No:
</td>
<td>
<b>1234567890</b>
</td>
</tr>
<tr>
<td align="right" colspan="2">
Location:
</td>
<td align="left">
<b>Hyderabad</b>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel ID="tbpnljobdetails" runat="server">
<HeaderTemplate>
Job Details</HeaderTemplate>
<ContentTemplate>
<asp:Panel ID="Panel2" runat="server">
<table align="center">
<tr>
<td>
</td>
<td align="right">
</td>
<td>
<b>Job Details</b>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
Job Type:
</td>
<td>
<b>Software</b>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
Industry:
</td>
<td>
<b>IT</b>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
Designation:
</td>
<td>
<b>Software Engineer</b>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
Company:
</td>
<td>
<b>aspdotnet-suresh</b>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
Phone No:
</td>
<td>
<b>1234567890</b>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
Location:
</td>
<td align="left">
<b>Hyderabad</b>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>

Try to use (also) the HeaderText property:
<asp:TabPanel ID="tbpnluser" runat="server" HeaderText="Item Detail">
<HeaderTemplate>
Item Detail</HeaderTemplate>
<ContentTemplate>

For the panel itemDetailEditPanel use this markup:
<asp:Panel ID="itemDetailEditPanel" runat="server" style="display: table-cell;align: left;">
<table style="width: 187px;">

I found that if my browser was in Compatibility mode, I would get this, but in Standards mode, it worked fine. After a bunch of hacking, I found this workaround for Compatibility mode:
Try adding this to your style tag:
/* Deals with TabPanel height issue in Compatibility mode */
.ajax__tab_xp .ajax__tab_header .ajax__tab_tab
{
height: 22px !important;
}
the !important helps because something else was shrinking the height, causing the whitespace to appear below. !important ensures that your code takes priority.

Related

Update an UpdatePanel from a ModalPopUpExtender

I can't get to update an updatepanel when it is being called upon by a modalpopupextender. It's a small search popup window, it has two parts the patient's name part and the history part. The popupextender is triggered by an image button and in the OnClick codebehind:
protected void imgSearchPrincipal_Click(object sender, ImageClickEventArgs e)
{
tblMedHistory.Visible = false;
upMedHistory.Update();
pnlMedSrchPrincipal_Ext.Show();
}
Here is the script for the pop up window:
<div runat="server" id="divMedSearch" class="cls_gen_style">
<asp:Panel runat="server" ID="pnlMedSearch" >
<table runat="server" class="tables_gen tblPop"><tr><td>
<table style="border-spacing:0px">
<tr><td style="height:10px"></td></tr>
<tr><td colspan="6" class="tp_dotline"></td></tr>
<tr>
<td colspan="4" class="rw_header">SEARCH</td>
<td colspan="2" style="background-color:navy; text-align:center"><asp:LinkButton runat="server" ID="lbClose" Style="color:white" Text="CLOSE" OnClick="lbClose_Click"></asp:LinkButton> </td>
</tr>
<tr><td colspan="6" class="bt_dotline"></td></tr>
<tr><td style="height:7px"></td></tr>
<tr>
<td style="width:3px"></td>
<td>PATIENT NAME</td>
<td><input type="text" runat="server" id="txt_srch_patient" /></td>
<td></td>
<%--<td><input type="button" runat="server" id="btnSearch" class="btn btn-info btns_text" value="SEARCH" /></td>--%>
<td><asp:Button runat="server" ID="btnSearch" CssClass="btn btn-info btns_text" Text="SEARCH" OnClick="btnSearch_Click"/></td>
<td style="width:5px"></td>
</tr>
<tr>
<td colspan="2"></td>
<td>
<table style="font-size:8px">
<tr>
<td>SEARCH IN:</td>
<td style="width:3px"></td>
<td><asp:RadioButton runat="server" ID="rdoLastname" /> </td>
<td>LAST NAME</td>
<td><asp:RadioButton runat="server" ID="rdoFullname" /></td>
<td>FULL NAME</td>
</tr>
</table>
</td></tr>
<tr><td colspan="6" class="tp_dotline"></td></tr>
<tr><td style="height:5px"></td></tr>
<tr>
<td></td>
<td colspan="4">
<asp:GridView runat="server" ID="gvClientNames"
RowStyle-Wrap ="false"
ShowHeader="true"
HeaderStyle-Height="30px"
Font-Names="Arial,Sans-Serif"
CellPadding="4"
ForeColor="#333333"
GridLines="None"
RowHeaderColumn="1"
Width="100%"
BackColor="White"
Font-Size="10px"
AlternatingRowStyle-BackColor="AliceBlue"
AutoGenerateColumns="False"
ShowHeaderWhenEmpty="True"
HeaderStyle-BackColor="#507CD1"
HeaderStyle-ForeColor="White">
<Columns>
<%--<asp:BoundField DataField="claim_no" HeaderText="CLAIM NO" />--%>
<asp:BoundField DataField="policy_no" HeaderText="POLICY NO" />
<asp:BoundField DataField="name" HeaderText="NAME" HeaderStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
</td>
<td></td>
</tr>
<tr><td style="height:5px"></td></tr>
<tr><td colspan="6" class="tp_dotline"></td></tr>
<tr><td colspan="5" style="text-align:right"><input type="button" runat="server" id="btnSelName" class="btn btn-info btns_text" value="SELECT NAME" /> </td></tr>
</table>
<div runat="server" id="divMedHistory">
<asp:UpdatePanel runat="server" ID="upMedHistory"><ContentTemplate>
<table runat="server" id="tblMedHistory" style="width:100%">
<tr><td colspan="6" class="bt_dotline"></td></tr>
<tr>
<td></td>
<td colspan="2">MEDICAL HISTORY</td>
</tr>
<tr><td style="height:3px"></td></tr>
<tr>
<td></td>
<td colspan="4">
<asp:GridView runat="server" ID="gvMedHistory"
RowStyle-Wrap ="false"
ShowHeader="true"
HeaderStyle-Height="30px"
Font-Names="Arial,Sans-Serif"
CellPadding="4"
ForeColor="#333333"
GridLines="None"
RowHeaderColumn="1"
Width="100%"
BackColor="White"
Font-Size="10px"
AlternatingRowStyle-BackColor="AliceBlue"
AutoGenerateColumns="False"
ShowHeaderWhenEmpty="True"
HeaderStyle-BackColor="#507CD1"
HeaderStyle-ForeColor="White">
<Columns>
<asp:BoundField DataField="claim_no" HeaderText="CLAIM NO" />
<asp:BoundField DataField="policy_no" HeaderText="POLICY NO" />
<asp:BoundField DataField="diagnosis" HeaderText="DIAGNOSIS" />
<asp:BoundField DataField="date" HeaderText="DATE" />
</Columns>
</asp:GridView>
</td>
</tr>
<tr><td style="height:5px"></td></tr>
<tr><td colspan="5" class="tp_dotline"></td></tr>
<tr><td colspan="5" style="text-align:right"><input type="button" runat="server" id="btnOpenClaim" class="btn btn-info btns_text" value="OPEN CLAIM" /> </td></tr>
<tr><td style="height:10px"></td></tr>
</table>
</ContentTemplate>
<%--<Triggers>
<asp:AsyncPostBackTrigger ControlID="imgSearchPrincipal" />
</Triggers>--%>
</asp:UpdatePanel>
</div>
</td></tr></table>
</asp:Panel>
<%--<asp:HiddenField ID="hfClientID" runat="server" />
<asp:HiddenField ID="hfOtherFeeID" runat="server" />
<asp:HiddenField ID="hfOtherDocID" runat="server" />
<%--<ajaxToolkit:ModalPopupExtender ID="pnlPolicyLogin_Ex" runat="server" TargetControlID="pnlPolicyLogin_ModalEx_Ctrl" PopupControlID="pnlPolicyLogin" BackgroundCssClass="modalLogin" Enabled="True" />--%>
<ajaxToolkit:ModalPopupExtender runat="server" ID="pnlMedSrchPrincipal_Ext" TargetControlID="imgSearchPrincipal" PopupControlID="pnlMedSearch" Enabled="true" ></ajaxToolkit:ModalPopupExtender>
<ajaxToolkit:ModalPopupExtender runat="server" ID="pnlMedSrchPatient_Ext" TargetControlID="imgSearchPatient" PopupControlID="pnlMedSearch" Enabled="true" ></ajaxToolkit:ModalPopupExtender>
</div>
This window pop-ups just fine. But the problem is I need to hide the tblMedHistory when the user clicks the imagebutton (imgSearchPrincipal). But if the user clicks a different imagebutton, I need to display the tblMedHistory back as it pops up. I can't get to hide the table when the div/panel is being called by the popextender. Any workaround?
Thanks,
I think I've finally solved this issue. Instead of pointing the TargetControlID of the ModalPopUpExtender to the image button that also triggers the visibility of the table, I reference the TargetControlID to a hidden field, so now the imagebutton controls the visibility of the table as well as the popup through codebehind without the use of the updatepanel

User interface error with width

I have some issues regarding css and UI.
Seems like when I click a button and there is a postback or a validation in my website, my divs, tables, tds, tr.. stop having the value I give them and change on their own.
I hate having everything so perfectly structured and then a validation control screws it.
for example:
This two images
image 1
image 2
Before and after clicking an APPLY button, and causing validation.
As you see, it changes the width.
my code for that is this:
<table>
<tr>
<td style="width: 105px">
<dx:ASPxLabel ID="lblAlarmGroup" runat="server" Text="<%$ Resources:Master, GroupnameText %>"
CssClass="CamelCase" AssociatedControlID="cmbAlarmGroup">
</dx:ASPxLabel>
:
</td>
<td style="width: 155px">
<dx:ASPxComboBox ID="cmbAlarmGroup" runat="server" ValueType="System.Int32" Width="150px"
DataSourceID="sqlDSAlarmGroups" TextField="GroupName" ValidationSettings-RequiredField-IsRequired="true"
ValueField="AlarmsListGroupsID" AutoPostBack="True" OnSelectedIndexChanged="cmbAlarmGroup_SelectedIndexChanged">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
</dx:ASPxComboBox>
</td>
<td style="width: 5px">
</td>
<td style="width: 105px">
<dx:ASPxLabel ID="lblAlarm" runat="server" Text="<%$ Resources:Master, AlarmText %>"
CssClass="CamelCase" AssociatedControlID="cmbAlarmsList">
</dx:ASPxLabel>
:
</td>
<td style="width: 155px">
<dx:ASPxComboBox Width="150px" ID="cmbAlarmsList" runat="server" ValueType="System.Int32"
AutoPostBack="True" OnSelectedIndexChanged="cmbAlarmsList_SelectedIndexChanged"
TextField="value" ValueField="key" ValidationSettings-RequiredField-IsRequired="true">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
</dx:ASPxComboBox>
</td>
</tr>
<tr>
<td colspan="5" style="width: 525px">
<hr />
</td>
</tr>
<tr>
<td style="width: 105px">
<dx:ASPxLabel ID="lblSite" runat="server" Text="<%$ Resources:Master, SiteText %>"
CssClass="CamelCase" AssociatedControlID="cmbSite">
</dx:ASPxLabel>
:
</td>
<td style="width: 155px">
<dx:ASPxComboBox Width="150px" ID="cmbSite" runat="server" ValueType="System.Int32"
OnSelectedIndexChanged="cmbSite_SelectedIndexChanged" TextField="value" ValueField="key"
AutoPostBack="True">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
</dx:ASPxComboBox>
</td>
<td style="width: 5px">
</td>
<td style="width: 105px">
<dx:ASPxLabel ID="lblDepartment" runat="server" Text="<%$ Resources:Master, DepartmentText %>"
CssClass="CamelCase" AssociatedControlID="cmbDepartment">
</dx:ASPxLabel>
:
</td>
<td style="width: 155px">
<dx:ASPxComboBox Width="150px" ID="cmbDepartment" runat="server" ValueType="System.Int32"
TextField="value" ValueField="key" OnSelectedIndexChanged="cmbDepartment_SelectedIndexChanged"
AutoPostBack="True">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
</dx:ASPxComboBox>
</td>
</tr>
<tr>
<td style="width: 105px">
<dx:ASPxLabel ID="lblLine" runat="server" Text="<%$ Resources:Master, LineText %>"
CssClass="CamelCase" AssociatedControlID="cmbLine">
</dx:ASPxLabel>
:
</td>
<td style="width: 155px">
<dx:ASPxComboBox Width="150px" ID="cmbLine" runat="server" TextField="value" ValueField="key"
ValueType="System.Int32" OnSelectedIndexChanged="cmbLine_SelectedIndexChanged"
AutoPostBack="True">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
</dx:ASPxComboBox>
</td>
<td style="width: 5px">
</td>
<td style="width: 105px">
<dx:ASPxLabel ID="lblOperation" runat="server" Text="<%$ Resources:Master, OperationText %>"
CssClass="CamelCase" AssociatedControlID="cmbOperation">
</dx:ASPxLabel>
:
</td>
<td style="width: 155px">
<dx:ASPxComboBox Width="150px" ID="cmbOperation" runat="server" ValueType="System.Int32"
TextField="value" ValueField="key" OnSelectedIndexChanged="cmbOperation_SelectedIndexChanged"
AutoPostBack="True">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
</dx:ASPxComboBox>
</td>
</tr>
<tr>
<td style="width: 105px">
<dx:ASPxLabel ID="lblShift" runat="server" Text="<%$ Resources:Master, ShiftText %>"
CssClass="CamelCase" AssociatedControlID="cmbShift">
</dx:ASPxLabel>
:
</td>
<td style="width: 155px">
<dx:ASPxComboBox Width="150px" ID="cmbShift" runat="server" TextField="value" ValueField="key"
ValueType="System.Int32" AutoPostBack="True">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
</dx:ASPxComboBox>
</td>
<td style="width: 5px">
</td>
<td style="width: 105px">
<dx:ASPxLabel ID="lblStation" runat="server" Text="<%$ Resources:Master, StationText %>"
CssClass="CamelCase" AssociatedControlID="cmbStation">
</dx:ASPxLabel>
:
</td>
<td style="width: 155px">
<dx:ASPxComboBox Width="150px" ID="cmbStation" runat="server" TextField="value" ValueField="key"
ValueType="System.Int32" AutoPostBack="True">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
</dx:ASPxComboBox>
</td>
</tr>
<tr>
<td colspan="5" style="width: 525px">
<hr />
</td>
</tr>
<tr>
<td colspan="2" style="width: 260px">
<dx:ASPxLabel ID="lblNoficationInterval" runat="server" Text="<%$ Resources:Master, NotificationSendIntervalText %>"
AssociatedControlID="aspxseNotificationInterval">
</dx:ASPxLabel>
:
</td>
<td style="width: 5px">
</td>
<td colspan="2" style="width: 260px">
<dx:ASPxSpinEdit ID="aspxseNotificationInterval" runat="server" Height="21px" Number="5"
MaxValue="10000" MinValue="5">
</dx:ASPxSpinEdit>
</td>
</tr>
<tr>
<td colspan="2" style="width: 260px">
<dx:ASPxLabel ID="lblExcalationInterval" runat="server" Text="<%$ Resources:Master, EscalationSendIntervalText %>"
AssociatedControlID="aspxseEscalationInterval">
</dx:ASPxLabel>
:
</td>
<td style="width: 5px">
</td>
<td colspan="2" style="width: 260px">
<dx:ASPxSpinEdit ID="aspxseEscalationInterval" runat="server" Height="21px" Number="10"
MaxValue="10000" MinValue="5">
</dx:ASPxSpinEdit>
</td>
</tr>
</table>
I've been having this issues all along my project and I didnt came with a solid solution.
Did this happen to any of you?
What should be the solution? Making CSS classes and assign EVERYTHING to them?
Thank you
EDIT:
I removed the validation from those 2 dropdowns but when I put a value in them, it occurs what you can see in the image.
And it only occurrs in that case; if the item selected is other, that UI dissorder is not happening
Image 3
Any clue?
It looks like you are using Dev Express controls. If you inspect the HTML that is rendered from the Dev Express controls using your browser's developer tools, you will see that they actually do not render HTML inputs or selects, instead they nest HTML inputs and selects inside of HTML tables.
The tables usual put the input control in one column and the validation error message in a different column. Dev Express exposes properties in which you can change the look of the validation error messages, but you won't be able to change how the error message is rendered (inside the table column).
One solution would be to set ErrorDisplayMode="None" on your controls, which will hide the validation messages. Then via JavaScript you can handle the validation event of your controls and display a custom error message.
For example:
<script type="text/javascript">
function cmbStation_Validation(s, e) {
alert(s.errorText);
}
</script>
<dx:ASPxComboBox Width="150px" ID="cmbStation" runat="server" TextField="value" ValueField="key" ValueType="System.Int32" AutoPostBack="True">
<DisabledStyle BackColor="LightGray" ForeColor="Black" />
<ClientSideEvents Validation="cmbStation_Validation">
<ValidationSettings ErrorDisplayMode="None">
</ValidationSettings>
</dx:ASPxComboBox>

How to get this ListView as a two-column table?

I am a new ASP.NET developer and I am struggling in getting the ListView that I am working on it as the image shown below:
How to do that?
My ASP.NET Code:
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" >
<ItemTemplate>
<tr style="">
<td>
<p>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</p>
</th>
<td>
<p>
<asp:Label ID="UsernameLabel" runat="server"
Text='<%# Eval("Username") %>' />
</p>
</td>
<td>
<p>
<asp:Label ID="JobTitleLabel" runat="server" Text='<%# Eval("JobTitle") %>' />
</p>
</td>
<td>
<p>
<asp:Label ID="DivisionLabel" runat="server" Text='<%# Eval("DivisionName") %>' />
</p>
</td>
<td>
<p>
<asp:Label ID="RoleLabel" runat="server" Text='<%# Eval("RoleName") %>' />
</p>
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table id="Table2" runat="server">
<tr id="Tr5" runat="server">
<td id="Td4" runat="server">
<table ID="itemPlaceholderContainer" runat="server" border="1" style="">
<tr id="Tr6" runat="server">
<td id="Td6" runat="server" colspan="3">
<center>Personal Information</center>
</td>
</tr>
<tr id="Tr9" runat="server" style="">
<th id="Th3" runat="server">
Name</th>
</tr>
<tr id="Tr10" runat="server">
<th id="Th4" runat="server">
Username</th>
</tr>
<tr id="Tr11" runat="server">
<th id="Th5" runat="server">
JobTitle</th>
</tr>
<tr id="Tr12" runat="server">
<th id="Th6" runat="server">
Badge Number</th>
</tr>
<tr id="Tr13" runat="server">
<th id="Th7" runat="server">
Division</th>
</tr>
<tr id="Tr14" runat="server">
<th id="Th8" runat="server">
Role</th>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr id="Tr8" runat="server">
<td id="Td7" runat="server" style="">
<asp:DataPager ID="DataPager1" runat="server" PageSize="5">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
What I am getting right now is listing the headers or titles on the left column and the retreived values underneath them in a one instead of showing each value with its header. Here's a snapshot of what I am getting right now:
UPDATE:
UPDATE #2:
I am still struggling with this issue and getting the same result as in the snapshot.
Your html is so massive.
<tr style="">
**<td>**
<p>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</p>
**</th>**
see a mark **.Open td and closing with th.
<tr style="">
<td>
<p>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</p>
</th>
<td>
<p>
<asp:Label ID="UsernameLabel" runat="server"
Text='<%# Eval("Username") %>' />
</p>
</td>
Close your tr after above code and reopen your tr for next row.
HERE IS THE JSFIDDLE: http://jsfiddle.net/collabcoders/xSbyG/
Okay. I reworked it and tested it. This is the result I get:
First I add some css to clean the code and formatting.
<style>
.rightcolumn {
text-align:right;
height:25px;
text-overflow:ellipsis;
overflow: hidden;
white-space:nowrap;
font-weight:bold;
}
.leftcolumn {
text-align:left;
height:25px;
text-overflow:ellipsis;
overflow: hidden;
white-space:nowrap;
}
</style>
Then the ListView Template and Layout:
<asp:listview id="ListView1" runat="server" datasourceid="SqlDataSource1">
<ItemTemplate>
<table style="width:200px;">
<tr>
<td class="leftcolumn">
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="UsernameLabel" runat="server" Text='<%# Eval("Username") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="JobTitleLabel" runat="server" Text='<%# Eval("JobTitle") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="BadgeNumberLabel" runat="server" Text='<%# Eval("BadgeNumber") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="DivisionLabel" runat="server" Text='<%# Eval("DivisionName") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="RoleLabel" runat="server" Text='<%# Eval("RoleName") %>' />
</td>
</tr>
</table>
</ItemTemplate>
<LayoutTemplate>
<table id="outertable" border="1" runat="server">
<tr>
<td colspan="2" style="font-weight:bold;">
<center>Personal Information</center>
</td>
</tr>
<tr>
<td>
<table id="itemPlaceholderContainer" style="width:150px;" runat="server">
<tr>
<td class="rightcolumn">
Name
</td>
</tr>
<tr>
<td class="rightcolumn">
Username
</td>
</tr>
<tr>
<td class="rightcolumn">
Job Title
</td>
</tr>
<tr>
<td class="rightcolumn">
Badge Number
</td>
</tr>
<tr>
<td class="rightcolumn">
Division
</td>
</tr>
<tr>
<td class="rightcolumn">
Role
</td>
</tr>
</table>
</td>
<td id="itemPlaceholder" runat="server">
<!---List Item Template Goes Here--->
</td>
</tr>
<tr>
<td colspan="2">
<asp:DataPager ID="DataPager1" runat="server" PageSize="5">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:listview>

Default button not triggered in Panel

Whys is not lblMasterPhoneNumbers onclick method trigger when i press enter in the textbox?
<asp:Panel ID="pnlSearch" DefaultButton="lbMasterPhoneNumber" runat="server">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:TextBox ID="txtSearchMaster" runat="server" CssClass="TextBoxSearchActive" EnableTheming="false" />
</td>
<td>
<%--<asp:Button ID="btnSearchMaster" CssClass="SearchButton" runat="server" OnClick="btnSearchMaster_Click" CausesValidation="false" EnableTheming="False" />--%>
</td>
</tr>
<tr>
<td colspan="2">
<div style="margin-right:3px; color:white">
<asp:LinkButton ID="lbMasterPhoneNumber" runat="server" Text="Phone number" ForeColor="White" onclick="lbMasterPhoneNumber_Click" OnClientClick="javascript:ActivateLoadingIndicator()" /> |
<asp:LinkButton ID="lbMasterCDR" runat="server" Text="CDR" ForeColor="White" onclick="lbMasterCDR_Click" /> |
<asp:LinkButton ID="lbMasterSMS" runat="server" Text="SMS" ForeColor="White" onclick="lbMasterSMS_Click" />
</div>
</td>
</tr>
</table>
</asp:Panel>
msdn states that defaultbutton property does not support linkbutton http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.panel.defaultbutton.aspx

I want to reduce the spacing in my asp.net webform

i want to reduce the spacing inside my web page:
The problem is the buttons below "back" and "next" is not visible without scrolling down
I have posted the code below:
<asp:View runat="server" ID="view_1">
<asp:ScriptManager ID="scrMgr" runat="server">
</asp:ScriptManager>
<h1 class="blue" style="margin-bottom:0px;">
<asp:Label ID="lbl_viewTitle1" runat="server" Text="Label"></asp:Label>
</h1>
<div style="margin:0px; padding:0px; border:none; clear:both;">
<table border="0">
<tr>
<td>
<table border="1" style="border-color: Green; border-width: thin;">
<tr>
<td valign="top" id="tdReadableContent" runat="server">
<div style="height: 167px; width:450px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="blue" style="height:16px!important;" colspan="3"><b>Your Current Settings</b></td>
</tr>
<tr style="width:10px"><td colspan="3"></td></tr>
<tr id="trUserDetail_read" runat="server">
<td class="tabRow" valign="baseline">
<asp:Label ID="lbl_view1_userID_Read" runat="server" Text="User ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_view1_userID_Read" ReadOnly="true" runat="server" AutoPostBack="true"
CssClass="text_box_gray"></asp:TextBox><div class="smallText" nowrap>
<%--(This would be the ID you would normally log on with.)--%></div>
</td>
<td> </td>
</tr>
<tr>
<td width="150" class="tabRow">
<asp:Label ID="lbl_panview3_label2_read" runat="server" Text="Store Number "></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_panview3_input2_read" CssClass="text_box_gray" ReadOnly="true" runat="server" MaxLength="4"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view1_surname_read" runat="server" Text="Surname"></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_view1_surname_read" ReadOnly="true" CssClass="text_box_gray" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr id="trFirstName_Read" runat="server">
<td width="150" class="tabRow">
<asp:Label ID="lbl_view1_firstName_Read" runat="server" Text="First Name"></asp:Label>
</td>
<td width="200">
<asp:TextBox ID="txt_view1_firstname_Read" ReadOnly="true" runat="server" CssClass="text_box_gray"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td></td>
<td>
<%--<asp:Label ID="Label1" CssClass="errorText" runat="server"></asp:Label>--%>
</td>
</tr>
<tr>
<td class="tabRow">
<%--<asp:Label ID="Label2" runat="server" Text="Employee Number "></asp:Label>--%>
</td>
<td width="200">
<%--<asp:TextBox ID="TextBox1" runat="server"
CssClass="text_box_3" MaxLength="10"></asp:TextBox>--%>
</td>
</tr>
</table>
</div>
<asp:Label runat="server" ID="label11"></asp:Label>
<hr class="hrRequestorForm" />
<div id="divRoleDepartment_ReadOnly" runat="server" style="margin-left:20px; height:390px; overflow:auto;" class="tabel1Parent">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<asp:Panel ID="panelStore_Read" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top">
<asp:GridView ID="gvRoleDepartment_ReadOnly" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkRole_Read" runat="server" Enabled="false" />
<input type="hidden" id="hdRoleCode_Read" value="<%#Bind('ddl_code') %>" runat="server" />
<input type="hidden" id='hdDepCode_Read' value="<%#Bind('dep_code') %>" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ddl_item" HeaderText="Role" ItemStyle-CssClass="roleColumn2" />
<asp:BoundField DataField="dep_name" HeaderText="Department" ItemStyle-CssClass="departmentColumn" />
</Columns>
<EmptyDataTemplate>
<div class="tabel1Parent">
<table border='0' cellpadding='0' cellspacing='0' style='border-color: green; border-width: thin;
width: 390px; border-left: #9787b1 solid 1px; border-top: #9787b1 solid 1px;'>
<tr>
<td class='roleColumn'>
<b>Role</b>
</td>
<td class='departmentColumn'>
<b>Department</b>
</td>
</tr>
</table>
</div>
</EmptyDataTemplate>
</asp:GridView>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top">
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</div>
</td>
<td valign="top" >
<div style="height:160px; width:450px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="blue" style="height:16px!important;" colspan="3"><b>
<asp:Label ID="lblNewSettings" runat='server' Text="Your New Settings"></asp:Label>
</b></td>
</tr>
<tr id="trUserDetail" runat="server">
<td class="tabRow" valign="baseline">
<asp:Label ID="lbl_view1_userID" runat="server" Text="User ID "></asp:Label>
</td>
<td class="textFieldColumn">
<asp:TextBox ID="txtUserID" TabIndex="1" text="Enter User id.."
runat="server" AutoPostBack="true"
CssClass="text_box_highlight"
onfocus="defaultStyle();"
onkeypress="ChangeUserIdBackground();"
MaxLength ="50"></asp:TextBox><span id="starUserId" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvUserID" runat="server" ControlToValidate="txtUserID"
ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator><div class="smallText" nowrap>
(This would be the ID you would normally log on with.)</div></td>
</tr>
<tr>
<td colspan="2" style="padding-left:135px">
<asp:Label ID="lblUserExists" CssClass="errorText" runat="server"></asp:Label>
<asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server"
ControlToValidate="txt_panview3_input2" ErrorMessage="Store should be a number"
ValidationExpression="[0-9]+"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td width="150" class="tabRow">
<asp:Label ID="lbl_panview3_label2" runat="server" Text="Store Number "></asp:Label>
</td>
<td>
<asp:TextBox ID="txt_panview3_input2" runat="server"
MaxLength="4" CssClass="text_box_3">0000</asp:TextBox>
<span id="starStoreNumber" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvStoreNumber" runat="server"
ControlToValidate="txt_panview3_input2" ErrorMessage=" Required field"
ValidationGroup="Form2" ></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lbl_view1_surname" runat="server" Text="Surname "></asp:Label>
</td>
<td >
<asp:TextBox ID="txt_view1_surname" runat="server"
CssClass="text_box_3"
MaxLength ="50"></asp:TextBox>
<span id="starSurName" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvSurName" runat="server" ControlToValidate="txt_view1_surname"
ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr id="trFirstName" runat="server">
<td width="150" class="tabRow">
<asp:Label ID="lbl_view1_firstName" runat="server" Text="First Name"></asp:Label>
</td>
<td >
<asp:TextBox ID="txt_view1_firstname" runat="server"
CssClass="text_box_3"
MaxLength ="50"></asp:TextBox>
<span id="starFirstName" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ControlToValidate="txt_view1_firstname"
ErrorMessage=" Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="tabRow">
<asp:Label ID="lblEmployeeNumber" runat="server" Text="Employee Number "></asp:Label>
</td>
<td width="280">
<asp:TextBox ID="txtEmployeeNumber" runat="server"
CssClass="text_box_3" MaxLength="6"></asp:TextBox>
<span id="starEmployeeNumber" runat="server" style="color:Red"> *</span>
<asp:RequiredFieldValidator ID="rfvEmplyeeNumber" runat="server" ControlToValidate="txtEmployeeNumber"
ErrorMessage="Required field" ValidationGroup="Form2"></asp:RequiredFieldValidator>
</td>
<td>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server"
ControlToValidate="txtEmployeeNumber" ErrorMessage="Enter a numeric value"
ValidationExpression="[0-9]+"></asp:RegularExpressionValidator>
</td>
</tr>
</table>
<b><asp:Label ID="lblCaption2" runat="server" Text="Note: All fields are mandatory" ForeColor="Red"></asp:Label></b>
</div>
<hr class="hrRequestorForm" />
<div style="padding-left:20px;" id="divRoleDepartment" runat="server">
<div class="tabel1Parent">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Panel ID="panelStore" runat="server">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top">
<asp:GridView ID="gvRoleDepartment" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkRole" runat="server" />
<input id="hdRoleCode" runat="server" type="hidden"
value="<%#Bind('ddl_code') %>" />
<input id="hdDepCode" runat="server" type="hidden"
value="<%#Bind('dep_code') %>" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField ControlStyle-CssClass="roleColumn" ControlStyle-Width="300px"
DataField="ddl_item" HeaderText="Role" ItemStyle-CssClass="roleColumn" />
<asp:BoundField ControlStyle-CssClass="departmentColumn"
ControlStyle-Width="120px" DataField="dep_name" HeaderText="Department"
ItemStyle-CssClass="departmentColumn" />
</Columns>
</asp:GridView>
<span ID="lbl_chkBx_store_workunit" class="errorText"></span>
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</div>
<br />
<div>
<table>
<tr>
<td>
<asp:Label ID="lblException" runat="server" CssClass="errorText"></asp:Label>
</td>
</tr>
</table>
</div>
<br />
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<br />
<div>
<table>
<tr>
<td>
<asp:Button ID="btn_view1_back" runat="server" Text="Back" CausesValidation="False"
ValidationGroup="Form2" />
<asp:Button ID="btn_View1_Next" runat="server" CausesValidation="true" Text="Next"
ValidationGroup="Form2" OnClientClick="return check_sel();" UseSubmitBehavior="True" />
<%
'mahesh code
'replaced OnClientClick="return ValidateDropDown(); with OnClientClick="return check_sel() "
%>
</td>
</tr>
</table>
</div>
<br />
</td>
</tr>
</table>
</div>
</asp:View>
Please help #!
You say your problem is that the buttons are not into view. You can scroll your control into view by using this technique. Or you can load the page on my screen, I have a bigger monitor.
What I'm trying to say: if it's visible on your screen after redesign, anybody with a smaller screen or a resized browser window still won't see it.
If you want to-the-point help on your HTML design, I suggest you upload a trimmed down example of your problem that we can copy and paste to test (or show an online link of your current page).
Lose the tables, or at the very least, remove the unnecessary <div> and <br> tags.
Another option, provided you do not have to support old versions of Internet Explorer, is to use position: fixed to "stick" your buttons to the bottom of the viewable window.
<div style="position: fixed; bottom: 0px;">
<asp:Button ID="btn_view1_back" ... />
<asp:Button ID="btn_view1_next" ... />
</div>

Resources