I created a webpage with the uploaded files and the uploading control in asp.net. I got a problem that is design problem.
<table style="width:500px;height:500px">
<tr>
<td>Uploading page<td>
</tr>
<tr>
<td style="height:300px;overflow:auto">
<asp:Repeater ID="UploadedFileList" runat="server">
<ItemTemplate>
<%# Eval("FileName") %>
</ItemTemplate>
</asp:Repeater>
<td>
</tr>
<tr>
<td><asp:FileUpload ID="FileUpload1" runat="server"/></td>
</tr>
</table>
I want to be overflow the sencod row. How can I do that?
You should keep another DIV inside the td to work better in this situation.
<table style="width:500px;height:500px">
<tr>
<td>Uploading page<td>
</tr>
<tr>
<td style="height:300px;">
<div style="height:300px;overflow:auto">
<asp:Repeater ID="UploadedFileList" runat="server">
<ItemTemplate>
<%# Eval("FileName") %>
</ItemTemplate>
</asp:Repeater>
</div>
<td>
</tr>
<tr>
<td><asp:FileUpload ID="FileUpload1" runat="server"/></td>
</tr>
</table>
Related
I have an asp.net page in which I have a ckeditor control and ajax file upload tool. I want to show user certain message when he tries to leave the page without saving data.I am beginner in JavaScript/JQuery and would like to find some easy solution directly implemented into asp.net code.If possible can you provide step by step implementation of dirty bit functionality.
`<script>
window.onbeforeunload = function (e) {
return 'Dialog text here.';
};
</script>`
Above code shows me the message even if nothing has changed on the page.How do I apply it to specific control like ckeditor/ajaxuploadctrl etc
Below is the HTML code
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="DirtyBit">
<form id="form" runat="server">
Country : <asp:DropDownList ID="drpCountry" runat="server"></asp:DropDownList>
<br />
<table style="width: 100%; height: 337px;">
<tr>
<td class="auto-style2">TV :</td>
<td class="auto-style3"> <CKEditor:CKEditorControl ID="CKTV" BasePath="/ckeditor/" runat="server"
</CKEditor:CKEditorControl> </td>
</tr>
<tr>
<td class="auto-style6">BV :</td>
<td class="auto-style7"> <CKEditor:CKEditorControl ID="CKBV" BasePath="/ckeditor/" runat="server">
</CKEditor:CKEditorControl></td>
</tr>
<tr>
<td class="auto-style8">CA :</td>
<td class="auto-style9"> <CKEditor:CKEditorControl ID="CKCA" BasePath="/ckeditor/" runat="server">
</CKEditor:CKEditorControl></td>
</tr>
<tr>
<td class="auto-style10">CJ :</td>
<td class="auto-style11"> <CKEditor:CKEditorControl ID="CKCJ" BasePath="/ckeditor/" runat="server">
</CKEditor:CKEditorControl></td>
</tr>
<tr>
<td class="auto-style1">
Visa Form :</td>
<td><table id="attachedfiles">
<tr>
<td class="auto-style12">
<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:AjaxFileUpload ID="AjaxFileUpload11" runat="server" MaximumNumberOfFiles="5"
Width="400px" OnUploadComplete="OnUploadComplete" />
</td>
</tr>
</table></td>
</tr>
<tr>
<td class="auto-style4">
</td>
<td class="auto-style5">
<asp:Button ID="btnSave" runat="server" Height="30px" OnClick="btnSave_Click" Text="Save" Width="109px" />
</td>
</tr>
<tr>
<td class="auto-style4">
</td>
<td class="auto-style5">
</td>
</tr>
</table>
</form>
</div>
</asp:Content>
I am creating a webpage that is listing the names of places using ASP.NET. I am using a data source to read the data from a database file. The list view is displaying all the data in one column. What I am trying to do is add 7 rows of data and then as soon as the 7th row has been added, add another column, and then continue writing the data in the new created column. Here is my code:
<asp:ListView runat="server" DataSourceID="cwDataSource">
<ItemTemplate>
<tr style="">
<td>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</td>
<td>          </td>
<td>
VIEW STORE PAGE
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
</tr>
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderContainer" runat="server" border="0" style="">
<tr runat="server" style="">
<td>COLUMN #</td>
</tr>
<tr>
<td>
 
</td>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr>
<td>
 
</td>
</tr>
<tr>
<td>
 
</td>
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
Example of what the output should look like (The 'VIEW STORE PAGE' is just a link):
COLUMN 1 COLUMN 2
A.ADDED VIEW STORE PAGE H.ADDED VIEW STORE PAGE
B.ADDED VIEW STORE PAGE I.ADDED VIEW STORE PAGE
C.ADDED VIEW STORE PAGE J.ADDED VIEW STORE PAGE
D.ADDED VIEW STORE PAGE K.ADDED VIEW STORE PAGE
E.ADDED VIEW STORE PAGE L.ADDED VIEW STORE PAGE
F.ADDED VIEW STORE PAGE M.ADDED VIEW STORE PAGE
G.ADDED VIEW STORE PAGE N.ADDED VIEW STORE PAGE
Any help would be appreciated.
I got it working:
<asp:DataList ID="cwDataList" runat="server" DataSourceID="cwDataSource" RepeatDirection=Vertical RepeatColumns=2 style="text-align: center">
<ItemTemplate>
<table style="width: 500px;">
<tr style="">
<td align="left" style="width: 250px; height: 18px">
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</td>
<td align="left" style="width: 250px; height: 18px">
VIEW STORE PAGE
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
I am using a repeater control to view database table data, I want to add a link button next to each row to delete a specific row, how can I do that using vb.net??
There is nothing to do much, do you want to display it(link button for all the rows? if yes then try the following code)
<table cellpadding="0" cellspacing="0">
<tr valign="top" class="list_heading">
<td width="25%">
Column
</td>
<td width="25%">
Operation
</td>
<td width="19%" style="display: none;">
And/Or
</td>
<td width="25%">
Value
</td>
<td width="06%">
Remove
</td>
</tr>
<tbody>
<asp:Repeater ID="rpSearchItems" runat="server">
<ItemTemplate>
<tr>
<td style="display: none;">
</td>
<td>
<%# Eval("ColumnName") %>
</td>
<td>
<%# Eval("Operation") %>
</td>
<td style="display: none;">
<%# Eval("AndOr") %>
</td>
<td>
<%# Eval("Value") %>
</td>
<td align="center">
<asp:ImageButton ID="ibtnRemoveSearchItem" ImageUrl="~/Controls/ImagesForSearch/Remove.png"
CommandArgument=' <%# Eval("Id") %>' CssClass="RemoveUitem" ToolTip="Remove Item"
runat="server" OnClick="ibtnRemoveSearchItem_Click" />
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
<tr valign="top" class="list_bottom">
<td colspan="6">
</td>
</tr>
</table>
And in code behind code you can go like this:
Protected Sub ibtnRemoveSearchItem_Click(sender As Object, e As EventArgs)
ImageButton ibtnRemoveSearchItem = (ImageButton)sender;
Int32 Id = Convert.ToInt32(ibtnRemoveSearchItem.CommandArgument);
//Using the above two lines you can get the Coomand Argument, pass it to you delete stored proc thats all
// do your stuff here
End Sub
hope this will help you
UPDATE : If you want to add it conditionally then you can do it from "OnItemDataBound" event of repeater
for much info review this
This one also can help you
I want to hide a column of ListView based on the role from the code behind. Here's the mark-up and the code:
<asp:ListView ID="lvTimeSheet" runat="server">
<LayoutTemplate>
<table id="TimeSheet">
<thead>
<tr>
<th id="thDelete" runat="server" Visible='<%# IsAdmin() %>'>
Select
</th>
</tr>
</thead>
<tbody>
<tr id="itemPlaceholder" runat="server" />
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox ID="cbMarkAsComplete" runat="server" onclick="selectMe(this)" Text=" Delete" />
</td>
</ItemTemplate>
</asp:ListView>
In the ListView layout template I have a <th> which has attribute id="thDelete" runat="server" Visible='<%# IsAdmin() %>' . In the code behind,
Public Function IsAdmin() As Boolean
If "user is admin" Then
Return True
Else
Return False
End If
End Function
But that column id="thDelete" is visible all the time. How do I go about hiding the column based on some condition from the code behind? Thank you for any input.
The tags with the attribute runat="server" can't allow inclusion <% %>. Try this:
<asp:ListView ID="lvTimeSheet" runat="server">
<LayoutTemplate>
<table id="TimeSheet">
<thead>
<% If IsAdmin() Then %>
<tr>
<th id="thDelete" runat="server">
Select
</th>
</tr>
<% End If %>
</thead>
<tbody>
<tr id="itemPlaceholder" runat="server" />
</tbody>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox ID="cbMarkAsComplete" runat="server" onclick="selectMe(this)" Text=" Delete" />
</td>
</ItemTemplate>
</asp:ListView>
Please, try this:
<LayoutTemplate>
<table id="TimeSheet">
<thead>
<tr>
<th id="thDelete" runat="server" Visible='<%# If( IsAdmin().tostring()="True", "true", "false") %>'>
Select
</th>
</tr>
</thead>
<tbody>
<tr id="itemPlaceholder" runat="server" />
</tbody>
</table>
</LayoutTemplate>`
I am creating a list of data using Repeater Control. Some of the rows might have other rows that should be toggled using the main row's clickable image.
Here, is the HTML part
<table cellpadding="2" cellspacing="0" width="100%">
<asp:Repeater ID="repeatLockers" runat="Server">
<HeaderTemplate>
<tr>
<td> </td>
<td>A</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr id="trItem" class="SomeParentClass" runat="server">
<td>
<img id="imgToggleHomeInfo" runat="server" alt="show/hide repetitves" src="icon_plus.gif"
style="cursor: pointer" />
</td>
<td>
<asp:Label ID="lbl" runat="server"></asp:Label>
</td>
</tr>
<tr id="trAddOnFee" runat="server" class="SomeClass" style="display: none;">
<td colspan="2">
<table cellpadding="4" cellspacing="2" width="100%">
<tr>
<td class="DgHeader">A</td>
<td class="DgHeader">B</td>
</tr>
<asp:Repeater ID="repeatRepetitives" runat="server">
<ItemTemplate>
<tr>
<td>
<asp:Label ID="lblA" runat="server"></asp:Label>
</td>
<td align="right">
<asp:Label ID="lblB" runat="server"></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
How could I toggle the Rows with class as "SomeClass" inside on click of imgToggleHomeInfo" image on its parent row using Jquery?
I'd find the parent row of the image then toggle it's next sibling.
$(document).ready( function() {
$("[id$='imageToggleHomeInfo']").click( function() {
$(this).closest('tr').next().toggle();
});
})