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>
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 designing Daily Attendance System. I have designed a page where Employer can put date range FROM--TO to find attendance of some worker for particular date range now i have been told to put NAME field too like an employer can search by date range but even for particular worker in particular date range. Now i am confused about design that where ti is best to put Name Drop DOwn List, which position on page sounds great for it which will make it better looking.
Interface:
You can try this.
<table>
<tr>
<td colspan="4">
Search By
</td>
</tr>
<tr>
<td>
Student Name :
</td>
<td colspan="3">
<asp:DropDownList ID="ddlStudentName" Width="320px" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
From Date :
</td>
<td>
<asp:TextBox ID="txtFromDate" runat="server" CssClass="datepicker" onkeypress="return false;"
Width="120px"></asp:TextBox>
</td>
<td style="width: 70px;">
To Date :
</td>
<td>
<asp:TextBox ID="txtToDate" runat="server" CssClass="datepicker" onkeypress="return false;"
Width="120px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
</td>
<td style="width: 70px;">
</td>
<td>
</td>
</tr>
</table>
Stack vertically with a two column three row layout. Labels on the left, right justified.
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 have made one html-table that contain a RadListView (with use of LayoutTemplate and ItemTemplate), and it works fine.
It's a Property-table with two columns ("CadastralNummer", "CadastralSomething").
(The table has as many rows as the property has cadastrals)
Now comes the tricky part for me!
I now have a list of properties, instead of just one.
How do repeat my table for every property below each other?
If it can help, here's my code for one table:
<table border="0" cellspacing="2" cellpadding="0" width="75%">
<thead>
<tr>
<td style="width: 25%;">
CadastralNummer
</td>
<td style="width: 25%;">
CadastralSomething
</td>
</tr>
</thead>
<telerik:RadListView runat="server"
ID="RadListViewProperty"
AllowPaging="false" DataKeyNames="PropertyNR"
OverrideDataSourceControlSorting="true"
ItemPlaceholderID="ListViewContainer"
OnItemDataBound="RadListViewProperty_ItemDataBound">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="listViewContainer" />
</LayoutTemplate>
<ItemTemplate>
<tbody>
<tr>
<td style="vertical-align: top;">
<asp:Label ID="lblCadastralNummer" runat="server" />
</td>
<td style="vertical-align: top;">
<asp:Label ID="lblCadastralSomething" runat="server" />
</td>
</tr>
</tbody>
</ItemTemplate>
</telerik:RadListView>
</table>
Have you seen the repeater control? This may provide what you need.
I put my table/RadListView inside another table/RadListView, and it worked fine.
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();
});
})