asp.net - SelectItemTemplate doesn't work - c#

I have two tables. First works fine - if button ID="Button1" CommandName="Select" pressed selected item turns red. But second table doesn't do the same if I pressed it's own button ID="Button2" CommandName="Select".
first table listView ID="ListViewGrSDtudents"
second table listView ID="ListViewGroups"
Does somebody now what why it doesn't work?
It's my .aspx code:
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form id="form1" runat="server">
<!-- Таблица групп -->
<div>
<asp:ListView ID="ListViewGroups"
runat="server"
ItemType="BD_Class_Library.studentGroup"
DataKeyNames="groupId"
SelectMethod="GetStudGroups"
InsertMethod="InsertStudGroup"
UpdateMethod="UpdateGroup"
DeleteMethod="DeleteGroup"
OnSelectedIndexChanged="ListViewGroups_SelectedIndexChanged">
<InsertItemTemplate>
<tr style="background-color: yellowgreen">
<td></td>
<td>
<input id="groupName" runat="server" value="<%# BindItem.groupName %>" /></td>
<td>
<asp:Button ID="Button1" Width="100%" CommandName="Insert" runat="server" Text="Вставить" />
</td>
</tr>
</InsertItemTemplate>
<EditItemTemplate>
<tr style="background-color: yellow">
<td><%# Item.groupId %></td>
<td>
<input id="groupName" runat="server" value="<%# BindItem.groupName %>" /></td>
<td>
<asp:Button CommandName="Update" runat="server" Text="Сохранить" />
<asp:Button CommandName="Cancel" runat="server" Text="Отмена" />
</td>
</tr>
</EditItemTemplate>
<LayoutTemplate>
<table border="1">
<tr style="background-color: darkgray">
<th>ID</th>
<th>Группа</th>
<th></th>
</tr>
<tr id="itemPlaceholder" runat="server"></tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="background-color: red">
<td><%# Item.groupId %></td>
<td><%# Item.groupName %></td>
<td>
<asp:Button CommandName="Edit" runat="server" Text="Изменить" />
<asp:Button CommandName="Delete" runat="server" Text="Удалить" />
</td>
</tr>
</SelectedItemTemplate>
<ItemTemplate>
<tr style="background-color: grey">
<td><%# Item.groupId %></td>
<td><%# Item.groupName %></td>
<td>
<asp:Button CommandName="Select" runat="server" Text="Выбрать" />
<asp:Button CommandName="Edit" runat="server" Text="Изменить" />
<asp:Button CommandName="Delete" runat="server" Text="Удалить" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</div>
<div>
<asp:ListView
ID="ListViewGrSDtudents"
runat="server"
ItemType="BD_Class_Library.student"
DataKeyNames="studId"
OnSelectedIndexChanging="ListViewGrSDtudents_SelectedIndexChanging"
OnSelectedIndexChanged="ListViewGrSDtudents_SelectedIndexChanged">
<SelectedItemTemplate>
<tr style="background-color: red">
<td><%# Item.studId %></td>
<td><%# Item.studFam %></td>
<td><%# Item.studName %></td>
<td><%# Item.studOtc %></td>
<td><%# Item.studBiletNum %></td>
</tr>
</SelectedItemTemplate>
<ItemTemplate>
<tr style="background-color: grey">
<td><%# Item.studId %></td>
<td><%# Item.studFam %></td>
<td><%# Item.studName %></td>
<td><%# Item.studOtc %></td>
<td><%# Item.studBiletNum %></td>
<td><asp:Button ID="Button2" CommandName="Select" runat="server" Text="Выбрать" /></td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table border="1" style="width: 60%">
<tr id="groupPlaceholder" runat="server"></tr>
<tr style="background-color: aqua">
<th>ID студента</th>
<th>Фамилия</th>
<th>Имя</th>
<th>Отчество</th>
<th>Студ. билет</th>
</tr>
<tr id="itemPlaceholder" runat="server" itemplaceholderid="itemPlaceholderStudent"></tr>
</table>
</LayoutTemplate>
<EmptyDataTemplate>
<table border="1" style="width: 60%">
<tr style="background-color: aqua">
<th>ID студента</th>
<th>Фамилия</th>
<th>Имя</th>
<th>Отчество</th>
<th>Студ. билет</th>
<th></th>
</tr>
<tr style="background-color: grey">
<td colspan="5" style="text-align: center">В данной группе нет студентов</<td>
</tr>
</table>
</EmptyDataTemplate>
</asp:ListView>
</div>
</form>
</body>
</html>
event - ListViewGrSDtudents_SelectedIndexChanged code:
protected void ListViewGrSDtudents_SelectedIndexChanged(object sender, EventArgs e)
{
int selStudent = (int)ListViewGrSDtudents.SelectedDataKey.Value;
Session["SelectedStudent"] = selStudent;
Session["SelectedStudentIndex"] = ListViewGrSDtudents.SelectedIndex;
Response.Redirect("~/Default.aspx");
}
Description Part 1
Description Part 2

Related

Databinder.eval inside gridview inside repeater

Is there a way to put the following code in a gridview so I can do paging without updating the entire page.
<ASP:PANEL id="ResultsPanel" border="1" HorizontalAlign="Center" runat="server" Width="100%">
<ASP:REPEATER id="SearchResultsRepeater" runat="server" EnableViewState="False">
<HEADERTEMPLATE>
<TABLE BORDER="1" Style="width:800px"" Align="center" >
<TR>
<TD Class="StdSectionHeader2" Style="color: #FFFFFF;" Colspan="8">Select a Provider Name</TD>
</TR>
<TR>
<TH ID="header1" Class="StdTablePadding5 BlueTD" >Name</TH>
<TH ID="header2" Class="StdTablePadding5 BlueTD">Service Area</TH>
<TH ID="header4" Class="StdTablePadding5 BlueTD">Gender</TH>
<TH ID="header5" Class="StdTablePadding5 BlueTD">City</TH>
<TH ID="header6" Class="StdTablePadding5 BlueTD">Zip Code</TH>
<TH ID="header7" Class="StdTablePadding5 BlueTD">Processing<BR />Status</TH>
<TH ID="header8" Class="StdTablePadding5 BlueTD">Phone</TH>
</TR>
</HEADERTEMPLATE>
<ITEMTEMPLATE>
<TD Class="StdTablePadding5"><a class="three" href="default.asp" target="_blank">
<%# getStartLink(DataBinder.Eval(Container.DataItem, "ServiceAreaName").ToString() )%>
<%# getNextPage(DataBinder.Eval(Container.DataItem, "ServiceAreaName").ToString(),HCQA.ReferralRegistry.UI.Validation.EncodeDigits(((HCQA.ReferralRegistry.UI.User)Session["User"]).EncryptionKey,DataBinder.Eval(Container.DataItem, "IndividualID").ToString()))%>
<%# getMidLink(DataBinder.Eval(Container.DataItem, "ServiceAreaName").ToString())%>
<%# DataBinder.Eval(Container.DataItem, "IndividualName").ToString()%>
<%# getEndLink(DataBinder.Eval(Container.DataItem, "ServiceAreaName").ToString())%></a>
</TD>
<TD HEADERS="header2" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "ServiceAreaName") %></TD>
<TD HEADERS="header4" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "gender") %></TD>
<TD HEADERS="header5" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "city") %></TD>
<TD HEADERS="header6" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "ZipCode") %></TD>
<TD HEADERS="header7" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "ProcessingStatus") %></TD>
<TD HEADERS="header8" Class="StdTablePadding5"><%# Util.FormatPhoneNumber(DataBinder.Eval(Container.DataItem, "PhoneNumber").ToString().Trim())%></TD>
</TR>
</ITEMTEMPLATE>
<ALTERNATINGITEMTEMPLATE>
<TR CLASS="AlternatingItemTemplate">
<TD HEADERS="header1" Class="StdTablePadding5">
<%# getStartLink(DataBinder.Eval(Container.DataItem, "ServiceAreaName").ToString() )%>
<%# getNextPage(DataBinder.Eval(Container.DataItem, "ServiceAreaName").ToString(),HCQA.ReferralRegistry.UI.Validation.EncodeDigits(((HCQA.ReferralRegistry.UI.User)Session["User"]).EncryptionKey,DataBinder.Eval(Container.DataItem, "IndividualID").ToString()))%>
<%# getMidLink(DataBinder.Eval(Container.DataItem, "ServiceAreaName").ToString())%>
<%# DataBinder.Eval(Container.DataItem, "IndividualName").ToString()%>
<%# getEndLink(DataBinder.Eval(Container.DataItem, "ServiceAreaName").ToString())%>
</TD>
<TD HEADERS="header2" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "ServiceAreaName") %></TD>
<TD HEADERS="header4" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "gender") %></TD>
<TD HEADERS="header5" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "city") %></TD>
<TD HEADERS="header6" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "ZipCode") %></TD>
<TD HEADERS="header7" Class="StdTablePadding5"><%# DataBinder.Eval(Container.DataItem, "ProcessingStatus") %></TD>
<TD HEADERS="header8" Class="StdTablePadding5"><%# Util.FormatPhoneNumber(DataBinder.Eval(Container.DataItem, "PhoneNumber").ToString().Trim())%></TD>
</TR>
</ALTERNATINGITEMTEMPLATE>
<FOOTERTEMPLATE>
</table>
</FOOTERTEMPLATE>
</ASP:REPEATER>

Page Break ASP.NET files

I'm currently trying to paginate a list of records, however; after the last table, the page break leaves an empty page. The set up is an Aspx files that incorporates two ascx files to draw the table records.
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="Table.ascx.cs" Inherits="%>
<br class="clear" /><br/>
<table class="report-table" cellspacing="0" cellpadding="2">
<asp:Repeater ID="Repeater1" runat="server" DataSource='<%# Eval("PatientBills") %>' OnItemDataBound="Repeater1_OnItemDataBound">
<HeaderTemplate>
<tr>
<td>Seq</td>
<td>Billing Id</td>
<td>Patient Id</td>
<td>Patient Name</td>
<td>Sex</td>
<td class="PrintNormalWrap">Admit Date</td>
<td class="PrintNormalWrap" style="width: 80px;">Social Security</td>
<td>DOB</td>
<td>POS</td>
<td>CPT</td>
<td>Mods</td>
<td style="width: 220px;">Diagnosis</td>
<td class="PrintNormalWrap">Referring Provider(UPIN)/ Comment</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr class="billRowShade<%# Container.ItemIndex % 2 %>">
<asp:TableCell ID="tableCellSequence" runat="server"><%# Container.ItemIndex + 1 %></asp:TableCell>
<td><%# FormatBillingId(Eval("Bill.BillingId")) %></td>
<td><%# FormatField(Eval("Patient.PatientId")) %></td>
<td id="printPatientName"><%# FormatField(Eval("Patient.LastName")) %>, <%# FormatField(Eval("Patient.FirstName")) %></td>
<td><%# FormatField(Eval("Patient.Sex")) %></td>
<td><%# FormatShortDate(Eval("Patient.DateOfAdmittance"))%></td>
<td><%# FormatField(Eval("Patient.SocialSecurityNumber")) %></td>
<td><%# FormatShortDate(Eval("Patient.DateOfBirth"))%></td>
<td><%# FormatField(Eval("Bill.Pos")) %></td>
<td><%# FormatField(Eval("Bill.CptCode")) %></td>
<td><%# FormatField(Eval("Bill.Mod")) %></td>
<td><%# FormatDiagnoses(Eval("Bill.Diagnoses"), Eval("Bill.BillDate"), Eval("Bill.SiteName")) %></td>
<td class="PrintNormalWrap"><%# FormatNotes(Eval("Patient.ReferringMd"), Eval("Patient.RefUpin"), Eval("Bill.Notes"), Eval("Bill.TimeEntry")) %> <%# FormatSupervisor( Eval("Bill.SupervisedByName"), Eval("Bill.DoctorName") ) %></td>
</tr>
<asp:TableRow ID="tableRowSpecialtyFieldDetails" runat="server" CssClass="specialtyFieldDetails">
<asp:TableCell ID="TableCell1" colspan="12" runat="server"><span id="spanSpecialtyFieldDetails" runat="server"></span></asp:TableCell>
</asp:TableRow>
</ItemTemplate>
</asp:Repeater>
</table>
<p style="page-break-after:always"></p>
<br/>

Creating a table column by column with repeater

I'm trying to make a comparison table for a website. There is a repeater which has a list of objects as the datasource.
The table will need to look like so:
Product1 Product2 Product3
ProductName1 ProductName2 ProductName3
ProductImage1 ProductImage2 ProductImage3
The problem is that I have the <tr> and <td> tags in the repeater and this causes the ProductNames to not be in the same row, so I get this:
Product1
ProductName1
ProductImage1
Product2
ProductName2
ProductImage2
Product3
ProductName3
ProductImage3
Is there a way to fill in the table column by column with the different items being in the same row?
Edit (added code):
<asp:PlaceHolder runat="server" ID="phPopUp">
<div id="popup-wrapper">
<asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<HeaderTemplate>
<table class="table-wrapper">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# ((PPG.Ecommerce.CategoryProduct)Container.DataItem).PageTitle %>
</td>
</tr>
<tr>
<td class="product-image">
<img src='<%# URLHelper.GetAbsoluteUrl(((PPG.Ecommerce.CategoryProduct)Container.DataItem).ProductImage) %>'
alt='<%# ((PPG.Ecommerce.CategoryProduct)Container.DataItem).PageTitle %>'
title='<%# ((PPG.Ecommerce.CategoryProduct)Container.DataItem).PageTitle %>' />
</td>
</tr>
<tr>
<td>
<%# ResHelper.GetString("PPGEcomUk.ProductCompare.Features") %>
</td>
</tr>
<tr>
<td>
<%-- Features --%>
<asp:Literal runat="server" ID="ltFeatures" />
</td>
</tr>
<%-- <tr>
<td>
<asp:Literal ID="ltApplication" runat="server" />
</td>
</tr>--%>
<tr>
<td>
<%# ResHelper.GetString("PPGEcomUk.ProductCompare.ColorType") %>
</td>
</tr>
<tr>
<td>
<%# ((PPG.Ecommerce.CategoryProduct)Container.DataItem).EcomProduct.ProductColorType %>
</td>
</tr>
<tr>
<td>
<%# ResHelper.GetString("PPGEcomUk.ProductCompare.Colors") %>
</td>
</tr>
<tr>
<td>
<asp:Literal ID="colors" runat="server" />
<asp:BulletedList runat="server" ID="blColors" />
</td>
</tr>
<tr>
<td>
<%# ResHelper.GetString("PPGEcomUk.ProductCompare.Colors") %>
</td>
</tr>
<tr>
<td>
<asp:Literal runat="server" ID="ltVolumes" />
</td>
</tr>
<tr>
<td>
<%-- substrate --%>
</td>
</tr>
<tr>
<td>
<%-- finish --%>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
repeat the repeater in each row:
<asp:PlaceHolder runat="server" ID="phPopUp">
<div id="popup-wrapper">
<table class="table-wrapper">
<tr>
<asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%# ((PPG.Ecommerce.CategoryProduct)Container.DataItem).PageTitle %>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr>
<asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td class="product-image">
<img src='<%# URLHelper.GetAbsoluteUrl(((PPG.Ecommerce.CategoryProduct)Container.DataItem).ProductImage) %>'
alt='<%# ((PPG.Ecommerce.CategoryProduct)Container.DataItem).PageTitle %>'
title='<%# ((PPG.Ecommerce.CategoryProduct)Container.DataItem).PageTitle %>' />
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr>
<asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%# ResHelper.GetString("PPGEcomUk.ProductCompare.Features") %>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr>
<asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%-- Features --%>
<asp:Literal runat="server" ID="ltFeatures" />
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<%-- <tr>
<td>
<asp:Literal ID="ltApplication" runat="server" />
</td>
</tr>--%>
<tr>
<asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%# ResHelper.GetString("PPGEcomUk.ProductCompare.ColorType") %>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr><asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%# ((PPG.Ecommerce.CategoryProduct)Container.DataItem).EcomProduct.ProductColorType %>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr><asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%# ResHelper.GetString("PPGEcomUk.ProductCompare.Colors") %>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr><asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<asp:Literal ID="colors" runat="server" />
<asp:BulletedList runat="server" ID="blColors" />
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr><asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%# ResHelper.GetString("PPGEcomUk.ProductCompare.Colors") %>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr><asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<asp:Literal runat="server" ID="ltVolumes" />
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr><asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%-- substrate --%>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
<tr><asp:Repeater runat="server" ID="rptProductInfo" OnItemDataBound="rptProductInfo_ItemDataBound">
<ItemTemplate>
<td>
<%-- finish --%>
</td>
</ItemTemplate>
</asp:Repeater>
</tr>
</table>

Get a Table column value into variable in C#

I am getting a itemtemplate field of form view using a table. I need to get a username into a variable so that I can delete a particular row.Username is unique.
This is my code:
<ItemTemplate>
<table>
<tr>
<td align="right"><b>User Name:</b></td>
<td><%# Eval("UserName") %></td>
</tr>
<tr>
<td align="right"><b>Password:</b></td>
<td><%# Eval("Password") %></td>
</tr>
<tr>
<td align="right"><b>First Name:</b></td>
<td><%# Eval("FirstName") %></td>
</tr>
<tr>
<td align="right"><b>Last Name:</b></td>
<td><%# Eval("LastName") %></td>
</tr>
<tr>
<td colspan="2">
<asp:LinkButton ID="EditButton"
Text="Edit"
CommandName="Edit"
RunAt="server"/>
<asp:LinkButton ID="NewButton"
Text="New"
CommandName="New"
RunAt="server"/>
<asp:LinkButton ID="DeleteButton"
Text="Delete"
CommandName="Delete"
RunAt="server"/>
</td>
</tr>
</table>
</ItemTemplate>
How can I do it in C#?
Any help will be appreciated.
I would use a server control instead, for example a Label, then you can find it via item.FindControl:
aspx:
<tr>
<td align="right"><b>User Name:</b></td><td>
<asp:Label Id="LblUserName" runat="server"
Text='<%# Eval("UserName") %>'></asp:label>
</td>
</tr>
.......
<asp:LinkButton ID="DeleteButton"
Text="Delete"
CommandName="Delete"
RunAt="server"
OnCommand="DeleteButton_Command" />
codebehind:
void DeleteButton_Command(Object sender, CommandEventArgs e)
{
if(e.CommandName == "Delete")
{
LinkButton btnDelete = (LinkButton)sender;
var item = (FormViewItem)btnDelete.NamingContainer;
Label LblUserName = (Label)item.FindControl("LblUserName");
String userName = LblUserName.Text;
}
}

Table display issue

I got a table with 2 nested tables inside that display my two repeaters. My repeaters display Home and office addresses respectively. The problem is that whenever I add a new record in one repeater, the other repeater table's display gets messed up. Like if I add a record in rpt1 , then table for rpt1 moves up and table for rpt2 goes down..ie the headers do not display in one single line . They move up and down when records are added or deleted. WHat I want is these headers to be fixed so if I add new records or delete records, the headings of both repeaters display on the same line...How do I fix this ? Hope its not confusing.
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">
<asp:Panel ID="pnlAddAddress" runat="server">
<asp:Repeater ID="rpt1" OnItemCommand="rpt1_ItemCommand" runat="server" OnItemDataBound="rpt1_OnItemDataBound">
<HeaderTemplate>
<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5" class="linegrey">
</td>
</tr>
<tr class="lgrey">
<td>
Address1
</td>
<td>
City
</td>
<td>
State
</td>
<td>
IsDefault
</td>
<td>
Actions
</td>
</tr>
<tr>
<td colspan="5" class="dots">
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:LinkButton ID="lnkAddressB" runat="server" Text='<%# Eval("Address1")%>' CommandName="DisplayAddressB" CommandArgument='<%#Eval("AddID") %>' CausesValidation=false></asp:LinkButton>
</td>
<td>
<%# Eval("City")%>
</td>
<td>
<%# Eval("State")%>
</td>
<td>
<%-- Visible='<%# Eval("IsDefault")%>'--%>
<asp:LinkButton ID="lnkDefaultB" Text="Set as Default" CommandName="SetDefaultB" runat="server" CommandArgument='<%# Eval("AddID") + "," + Eval("IsB") %>'
CausesValidation="false" Visible='<%# Eval("IsDefault")%>'></asp:LinkButton>
<asp:Label ID="labelDefaultB" Text="Yes" runat="server" Visible='<%# Eval("IsDefault")%>'></asp:Label>
</td>
<td>
<asp:ImageButton ID="lnkAdd" CommandArgument='<%#Eval("AddID") %>'
CausesValidation="false" CommandName="Edit" runat="server" ImageUrl="~/images/Edit.gif" Width="14" Height="14" ToolTip="Edit"></asp:ImageButton>
<asp:ImageButton ID="lnkDel" Text="Delete" CommandArgument='<%#Eval("AddID") %>'
CausesValidation="false" CommandName="Delete" runat="server" ImageUrl="~/images/Delete.gif" Width="14" Height="14" ToolTip="Delete"></asp:ImageButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</asp:Panel>
</td>
<td>
<asp:Panel ID="pnlSping" runat="server">
<asp:Repeater ID="rpt12" OnItemCommand="rpt12_ItemCommand" runat="server" OnItemDataBound="rptSpping_OnItemDataBound">
<HeaderTemplate>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5" class="linegrey">
</td>
</tr>
<tr class="lgrey">
<td>
Address1
</td>
<td>
City
</td>
<td>
State
</td>
<td>
IsDefault
</td>
<td>
Actions
</td>
</tr>
<tr>
<td colspan="5" class="dots">
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:LinkButton ID="lnkAddressS" runat="server" Text='<%# Eval("Address1")%>' CommandArgument='<%#Eval("AddID") %>' CommandName="DisplayAddressS" CausesValidation="false"></asp:LinkButton>
</td>
<td>
<%# Eval("City")%>
</td>
<td>
<%# Eval("State")%>
</td>
<td>
<asp:LinkButton ID="lnkDefaultS" Text="Set as Default" CommandName="SetDefaultS" runat="server" Visible=true CommandArgument='<%# Eval("AddID") + "," + Eval("IsS") %>'
CausesValidation="false"></asp:LinkButton>
<asp:Label ID="labelDefaultS" Text="Yes" runat="server" Visible=true></asp:Label>
</td>
<td>
<asp:ImageButton ID="lnkAdd" Text="Edit" CommandArgument='<%#Eval("AddID") %>'
CausesValidation="false" CommandName="Edit" runat="server" ImageUrl="~/images/Edit.gif" Width="14" Height="14" ToolTip="Edit"></asp:ImageButton>
<asp:ImageButton ID="lnkDel" Text="Delete" CommandArgument='<%#Eval("AddID") %>'
CausesValidation="false" CommandName="Delete" runat="server" ImageUrl="~/images/Delete.gif" Width="14" Height="14" ToolTip="Delete"></asp:ImageButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</asp:Panel>
</td>
</tr>
</table>
Use css attribute valign and set its value to top like this <td width="50%" valign="top">.
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" valign="top">
<asp:Panel ID="pnlAddAddress" runat="server">
......
</asp:Panel>
</td>
<td valign="top">
<asp:Panel ID="pnlSping" runat="server">
......
</asp:Panel>
</td>
</tr>
</table>
For headers look to use the <th> element, this will keep them at the top of the table.
Put the <table> tags you do have outside your repeater controls, make sure the repeater only renders a single row and the same for the header.
Unless you have good reason consider just wrapping the two tables in <div> tags as nested tables really don't work ideally for layout.

Categories