i try to add dropdown in repeater it shows me drodown above in table where as i want to show in status column
code in html
<div class="CSSTableGenerator">
<table border="0" width="100%" cellpadding="0"
cellspacing="0" id="results">
<asp:Repeater ID="Repeater2" OnItemCommand="Repeater2_ItemCommand" runat="server">
<HeaderTemplate>
<tr>
<td>
DocumentID
</td>
<td>
DocName
</td>
<td>
File Name
</td>
<td>
Document
</td>
<td>
Department
</td>
<td>
Status
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label Id="DocId" runat="server"></asp:Label>
<%#DataBinder.Eval(Container.DataItem, "DocID")%>
</td>
<td>
<asp:Label Id="DocName" runat="server"></asp:Label>
<%#DataBinder.Eval(Container.DataItem, "DocName")%>
</td>
<td>
<asp:Label Id="Uploadfile" runat="server"></asp:Label>
<%#DataBinder.Eval(Container.DataItem, "Uploadfile")%>
</td>
<td>
<asp:Label Id="DocType" runat="server"></asp:Label>
<%#DataBinder.Eval(Container.DataItem, "DocType")%>
</td>
<td>
<asp:Label Id="DepType" runat="server"></asp:Label>
<%#DataBinder.Eval(Container.DataItem, "DepType")%>
</td>
<td>
<asp:Label ID="Label1" runat="server"
Text='<%# Eval("ApproveID") %>' Visible = "false" />
<%#DataBinder.Eval(Container.DataItem, "ApproveID")%>
</td>
</tr>
<asp:Label ID="lblCountry" runat="server"
Text='<%# Eval("ApproveID") %>' Visible = "false" />
<asp:DropDownList ID="DropDownList4" runat="server"
EnableViewState="true" class="vpb_dropdown"
DataTextField="ApproveType"
DataValueField="ApproveID" AutoPostBack="true"
OnSelectedIndexChanged="DropDownList4_SelectedIndexChanged">
<asp:ListItem Text="Pending" selected="selected"
Value="3"></asp:ListItem>
<asp:ListItem Text="Approve"
Value="1"></asp:ListItem>
<asp:ListItem Text="Reject"
Value="2"></asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:Repeater>
</table>
<asp:Label ID="apfi" runat="server" Text="Label"></asp:Label><br />
<asp:Button ID="Button4" runat="server" Text="Button" onclick="Button4_Click" />
</div>
</div>
</center>
</div>
pleae have a look image below how i solve this ...where is mistake?
but it shows me like this
image
The mistake is that your DropDownList (and a Label) are between the table and tr elements, which is invalid HTML. The result client-side would be something like this:
<table>
<tr>
<td>...</td>
</tr>
<span>...</span>
<select>
<option>...</option>
</select>
</table>
There's no way to correctly render that because span and select aren't table row elements.
As for how to fix this, that entirely depends on how you want those elements to display. What you've attempted isn't a meaningful layout, so what is the layout you're looking for?
For example, if you want those elements to display in a table cell at the end of the row, you need to add a cell for them:
<table>
<tr>
<td>...</td>
<td>
<span>...</span>
<select>
<option>...</option>
</select>
</td>
</tr>
</table>
If you want them to display outside the table (maybe to the right of it?) then they'd need to be outside the table and you can use CSS to position them. (Alignment would be tricky, though. If they're logically part of the table, which they seem to be given that they're in its repeater, then they should be part of the table itself.)
Table structures have to be structured like a table.
(Note: Any time you have rendering issues like this, the first thing you should do is validate your markup. That would have identified specifically which parts are invalid and referenced the HTML specifications which define those parts.)
Related
i want to show a image in a repeater , image source is database. and datatype is varbinary(max). While adding image tag getting error saying -
"The server tag is not well formed."
how to add image in a data as well as image in a repeater control.
code
<asp:Repeater ID="RepterDetails" runat="server" DataSourceID="SqlDataSource1">
<HeaderTemplate>
<table style="border:1px solid #0000FF; width:500px" cellpadding="0">
<tr>
<td colspan="2">
<b>Testimonial</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table >
<tr>
<td >
Comments:
<asp:Label ID="lblSubject" runat="server" Text='<%#Eval("comment") %>'/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblComment" runat="server" Text='<%#Eval("designation") %>'/>
</td>
</tr>
</ItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1" Height="100px" Width="100px" runat="server" ImageUrl="<%# "data:Image/png;base64," + Convert.ToBase64String((byte[])Eval("organizationLogo")) %>"/>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
You need to either escape your double quotes or use a single quote for ImageUrl attribute.
so this
ImageUrl="<%# "data:Image/png;base64,"+Convert.ToBase64String((byte[])Eval("organizationLogo")) %>"
becomes this...
ImageUrl='<%# "data:Image/png;base64," + Convert.ToBase64String((byte[])Eval("organizationLogo")) %>'
I'm using a Repeater to create a grid but the grid doesn't fill the width of the screen. It cut offs and leaves blank spaces between the end of the repeater and the border on the right.
I tried setting the last <td> tag to width:100% which did make the line go all the way across but it caused all the other columns to move over to the far left and ruined the layout.
Code:
<tr>
<td style="border-left:1px solid; border-right:1px solid; height:400px" >
<asp:Repeater ID="rptHazDetails" runat="server">
<HeaderTemplate>
<table border="1">
<tr style="border-bottom:1px solid;">
<td>
UN Number, </br>
Proper Shipping Name
</td>
<td style="padding:5px">
Class , </br>
Packing Group
</td>
<td style="padding:5px">
Pieces
</td>
<td style="padding:5px">
Tunnel Code
</td>
<td style="padding:5px">
Gross KG
</td>
<td style="padding:5px">
Net KG
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="border-bottom:1px solid;">
<td style="padding:5px;">
<asp:Label ID="lblUNNumber" runat="server" Text='<%# Eval("UnNumber") %>' /> </br>
<asp:Label ID="lblProper" runat="server" Text='<%# Eval("Packages") %>' />
</td>
<td style="padding:5px;">
<asp:Label ID="lblClass" runat="server" Text='<%# Eval("IMOClass") %>' /> </br>
<asp:Label ID="lblPacking" runat="server" Text='<%# Eval("IMOPage") %>' />
</td>
<td style="padding:5px;">
<asp:Label ID="lblPieces" runat="server" Text='<%# Eval("PieceBreakDown") %>' />
</td>
<td style="padding:5px;">
<asp:Label ID="lblTunnelCode" runat="server" Text='<%# Eval("TunnelCode") %>' />
</td>
<td style="padding:5px;">
<asp:Label ID="lblGrossWeight" runat="server" Text='<%# Eval("GrossWeight","{0:0.##}") %>' />
</td>
<td style="padding:5px;">
<asp:Label ID="lblNetWeight" runat="server" Text='<%# Eval("NetWeight","{0:0.##}") %>' />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</td>
</tr>
I just want to border lines to reach all the across the screens and don't leave a gap.
I set:
table {
width: 100%;
}
This way the table will cover the entire window. I then can choose to give each column a different width in px or %, the best way is using bootstrap classes. So include in your header
Then you can set a class for example col-md-4 for giving that column a span of 4 columns, you can also hide the column for sm screens and do other effects. Go and check
http://getbootstrap.com/css/#grid
Or ask me more informations
Fabrizio Bertoglio
I'm using a repeater to present multiple items in a list.
I want to separate the items by a line using a <hr> tag. If I omit it, there's no line; however if I add it, it displays TWO line in the browser. Anyone have a suggestion for this?
Source code of the repeater:
<asp:Repeater ID="Lijst" runat="server" DataSourceID="SqlDataSource2"
OnItemDataBound="Lijst_ItemDataBound"
>
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<table style="width:100%">
<tr>
<td style="width:100%">
<asp:Label ID="Regel" runat="server"></asp:Label>
</td>
<td style="width:100%">
<asp:Label ID="Plancode" runat="server" font-size="20px" align=right></asp:Label>
</td>
</tr>
<hr />
</table>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
Rendering of one item:
<table style="width:100%">
<tr>
<td style="width:100%">
<span id="MainContent_Lijst_Regel_1"></span>
</td>
<td style="width:100%">
<span id="MainContent_Lijst_Plancode_1" align="right" style="font-size:20px;"></span>
</td>
</tr>
<hr />
</table>
Thanks in advance!
you can use a separator template and inside it insert
<asp:Repeater runat="server" ID="rp">
<SeparatorTemplate>
<hr />
</SeparatorTemplate>
</asp:Repeater>
I am creating a webpage which has been divide into two sides. On the left there is an image and on the right there can be various user inputs. I put the image into a table cell with float left and the inputs into a cell and float right.
Everything look like what I expect until I add a grid on the right using
<tr>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1">
</asp:GridView>
</tr>
Then the alignment of the contents on the right all move to the bottom of the left hand side. Can anyone can help me on this how to make it stick back to the right?
Here is my mark-up
<table id="leftT">
<tr id ="table_left" >
<td>
<asp:Image ID="Image1" runat="server" Height="356px" ImageUrl="~/Image/search.jpg" Width="200px" style="vertical-align:text-top"/>
</td>
</tr>
</table>
<table id ="rightT">
<tr>
<td>
<asp:Label ID="lblUserName" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="USERNAME" DataValueField="USERNAME">
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SOConnectionString %>" ProviderName="<%$ ConnectionStrings:SOConnectionString.ProviderName %>" SelectCommand="SELECT USERNAME FROM USERMASTER WHERE USERSTATUS = 1 AND USERACCESSRIGHTS = 'Non-Administrator'"></asp:SqlDataSource>
</td>
<td>
<asp:Label ID="lblCreateOnM" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:Label ID="lblCreateOn" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblDate" runat="server" Text="Label"></asp:Label>
</td>
<td><asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<asp:TextBox ID="txtDate" runat="server" Enabled="False"></asp:TextBox>
<asp:Calendar ID="Calendar1" runat="server" OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar></td>
<td>
<asp:Label ID="lblUpdateOnM" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:Label ID="lblUpdateOn" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblTask" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2" DataTextField="TASKNAME" DataValueField="TASKNAME">
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SOConnectionString %>" ProviderName="<%$ ConnectionStrings:SOConnectionString.ProviderName %>" SelectCommand="SELECT DISTINCT TASKNAME FROM TASKMASTER"></asp:SqlDataSource>
</td>
<td>
<asp:Label ID="lblUpdateByM" runat="server" Text="Label"></asp:Label>
</td>
<td>
<asp:Label ID="lblUpdateBy" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
Here The mistake you are doing is, you are creating two tables one below the other.Instead take only one table and two columns and places all the controls in these two columns as shown below
ex-
<table>
<tr>
<td id='Left_id'>
//Put all the left controls here
</td>
<td id='Right_id'>
//Put some controls here if required
<table>
<tr>
<td>
//some Controls Here
</td>
</tr>
</table>
</td>
</tr>
</table>
How do I prevent a table from wrapping when it is inside of an outer table cell?
Have a look at the simplified example at the bottom of my question.
My aspx-tablerow:
<tr runat="server" id="trButtons">
<td align="left" colspan="9" valign="top" style="white-space:nowrap"><br />
<asp:Button ID="btnImeiLookup" OnClick="btnImeiLookupClick" runat="server" ValidationGroup="VG_RMA_LOOKUP" CausesValidation="true" Text="lookup IMEI" ToolTip="lookup IMEI and check if RMA-Number can be generated" Width="120px" />
<asp:Button ID="BtnEdit" CommandName="Edit" CommandArgument='<%# Eval("idRMA")%>' ValidationGroup="VG_RMA_SAVE" runat="server" CausesValidation="false" Text="Edit" ToolTip="edit" Width="120px" />
<asp:Button ID="BtnAdd" runat="server" CommandName="Add" CausesValidation="false" Text="Add new" Width="130px" ToolTip="add new" />
<asp:Button ID="BtnDelete" runat="server" CommandName="Delete" CommandArgument='<%# Eval("idRMA")%>' CausesValidation="true" Text="Delete" Width="120px" ToolTip="delete" OnClientClick="return confirm('do you really want to delete this RMA?')" />
<uc4:RmaPrinterView ID="RmaPrinterView1" Visible="true" runat="server" />
</td>
</tr>
RmaPrinterView1 is an ASP.Net Usercontrol:
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="button" style="width:120px; white-space:nowrap" onclick="javascript:$('#TblPrinterView').jqprint();" value="Print" title="Print" />
</td>
</tr>
<tr>
<td>
<table id="TblPrinterView" style="display:none">
<tr>
<td style="width:100px;white-space:nowrap">
<asp:Label ID="LblRmaNumberDesc" runat="server" Text="RMA-Number:"></asp:Label>
</td>
<td>
<asp:Label ID="LblRmaNumber" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblImeiDesc" runat="server" Text="IMEI:"></asp:Label>
</td>
<td>
<asp:Label ID="LblImei" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblModelDesc" runat="server" Text="Model:"></asp:Label>
</td>
<td>
<asp:Label ID="LblModel" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblSiDpyDesc" runat="server" Text="SI/DPY:"></asp:Label>
</td>
<td>
<asp:Label ID="LblSiDpy" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LblSymptomCodesDesc" runat="server" Text="Symptoms:"></asp:Label>
</td>
<td>
<asp:Label ID="LblSymptomCodes" runat="server" Text="xxxxxxxxxxxxxx"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
As you can see, the Usercontrol with the inner table is wrapped:
I know that I should avoid table layout, but I needed a fast working solution ;-)
EDIT: a simplified sample that is also wrapping:
<table>
<tr>
<td style="white-space:nowrap">
<input type="button" value="b1" />
<input type="button" value="b2" />
<input type="button" value="b3" />
<table>
<tr>
<td style="white-space:nowrap"><input type="button" value="in table" /></td>
</tr>
</table>
</td>
</tr>
</table>
UPDATE:
The solution - as Jeroen mentioned - was to make the table an inline element with style="display: inline". The next problem was that I used an ASP.Net UpdatePanel inside the UserControl which is normally rendered as a Div. So the next block-element that causes my table to wrap. I only needed to set the UpdatePanel's RenderMode to Inline what causes it to be rendered as Span.
If the css white-space does not work, you can try to add nowrap="nowrap" to your td, just like you added valign="top".
Very ugly, but it should work.
Edit: Ah, now I see: A table is a block-level element so it will always go to a new line unless you make it an inline-element or float it.
table tr td {
white-space: nowrap;
}
You've put the table at odds with itself. It is set to finite pixel count and yet you don't want to wrap once that's exceeded. You might attempt:
white-space: nowrap;
overflow: hidden;