Solved

LinqDataSource Listview and FindControl Problems

Posted on 2011-03-17
9
1,008 Views
Last Modified: 2013-11-11

Hi EE,

I have a listview that is bound to linqdatasource.  The listview is also within a tab container.
I have tried several ways (for days now) to get this to work.
I tried using listviews ItemInserting  event and linqdatasource's inserting event but can't  find controls.
What do I need to do to get this working?

Thanks
Private Sub lstSchedules_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewInsertEventArgs) Handles lstSchedules.ItemInserting
   '   Dim dc As New SalonDataClassesDataContext
   '   Try
   '      Dim iRecID As Integer = 0

   '      Dim ddClient As DropDownList = CType(e.Item.FindControl("ddClientIns"), DropDownList)
   '      Dim ddService As DropDownList = CType(e.Item.FindControl("ddServiceOfferedIns"), DropDownList)
   '      Dim txtDate As TextBox = CType(e.Item.FindControl("txtCalendarIns"), TextBox)
   '      Dim txtStartTime As TextBox = CType(e.Item.FindControl("txtStartTimeIns"), TextBox)      'e.NewObject("SchedEndDateTime")
   '      Dim txtEndTime As TextBox = CType(e.Item.FindControl("txtEndTimeIns"), TextBox)      'e.NewObject("SchedEndDateTime")
   '      Dim dDate As Date = Convert.ToDateTime(txtDate.Text)

   '      Dim dStart As DateTime = Convert.ToDateTime(txtStartTime.Text)
   '      Dim dEnd As DateTime = Convert.ToDateTime(txtEndTime.Text)
   '      Dim g As Guid = SalonUtilities.GetUserID

   '      Dim vtmStart As New DateTime(dDate.Year, dDate.Month, dDate.Day, dStart.Hour, dStart.Minute, 0)
   '      Dim vtmEnd As New DateTime(dDate.Year, dDate.Month, dDate.Day, dEnd.Hour, dEnd.Minute, 0)
   '      Dim q = dc.stp_Schedule_Insert_Update(0, g, ddClient.SelectedValue, ddService.SelectedValue, 0, 0, vtmStart, vtmEnd, False, False, False, "", iRecID)

   '      e.Values("SchedStartDateTime") = vtmStart
   '      e.Values("SchedStart") = vtmStart.ToShortTimeString
   '      e.Values("SchedEnd") = vtmEnd.ToShortTimeString
   '      e.Values("SchedDate") = dDate
   '      e.Values("SchedID") = iRecID
   '      e.Values("LUServiceID") = ddService.SelectedValue
   '      e.Values("CustomerID") = ddClient.SelectedValue

   '      lstSchedules.InsertNewItem(True)

   '   Catch ex As Exception

   '   End Try
   'End Sub


  Private Sub lnqSchedules_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LinqDataSourceInsertEventArgs) Handles lnqSchedules.Inserting
      Dim txtDate As TextBox = CType(Me.lstSchedules.Items(Me.lstSchedules.SelectedIndex()).FindControl("ddtxtCalendarIns"), TextBox)
      If Not txtDate Is Nothing Then
         Dim txtStartTime As TextBox = CType(Me.lstSchedules.Items(Me.lstSchedules.SelectedIndex).FindControl("ddtxtCalendarIns"), TextBox)
         Dim txtEndTime As TextBox = CType(Me.lstSchedules.Items(Me.lstSchedules.SelectedIndex).FindControl("ddtxtCalendarIns"), TextBox)
         Dim dDate As Date = Convert.ToDateTime(txtDate.Text)

         Dim dStart As DateTime = Convert.ToDateTime(txtStartTime.Text)
         Dim dEnd As DateTime = Convert.ToDateTime(txtEndTime.Text)

         Dim vtmStart As New DateTime(dDate.Year, dDate.Month, dDate.Day, dStart.Hour, dStart.Minute, 0)
         Dim vtmEnd As New DateTime(dDate.Year, dDate.Month, dDate.Day, dEnd.Hour, dEnd.Minute, 0)

         e.NewObject("SchedStartDateTime") = vtmStart
         e.NewObject("SchedEndDateTime") = vtmEnd
         e.NewObject("UserID") = SalonUtilities.GetUserID


      End If

   End Sub




<asp:ListView ID="lstSchedules" runat="server" 
                     DataKeyNames="SchedID" DataSourceID="lnqSchedules" 
                     InsertItemPosition="LastItem">
                     <LayoutTemplate>
                         <div style="width:98%">
                             <table ID="itemPlaceholderContainer" runat="server" cellpadding="2" 
                                 style="vertical-align:top">
                                 <tr ID="Tr1" runat="server">
                                     
                                     <td class="ListViewHeader" style="width:15%">
                                         <asp:Label ID="lblDate" runat="server" Text="Schedule Date"></asp:Label>
                                     </td>
                                     
                                     <td class="ListViewHeader" style="width:20%">
                                         <asp:Label ID="lblClient" runat="server" Text="Client"></asp:Label>
                                     </td>
                                     <td class="ListViewHeader" style="width:20%">
                                         <asp:Label ID="lblService" runat="server" Text="Service"></asp:Label>
                                         
                                     </td>
                                     <td class="ListViewHeader" style="width:10%">
                                         <asp:Label ID="lblStart" runat="server" Text="Start time"></asp:Label>
                                         
                                     </td>
                                     <td class="ListViewHeader" style="width:10%">
                                         <asp:Label ID="lblEnd" runat="server" Text="End Time"></asp:Label>
                                         
                                     </td>
                                     
                                     <td class="ListViewHeader" style="width:15%">
                                         &nbsp;
                                         
                                     </td>
                                     
                                      <td class="ListViewHeader" style="width:15%">
                                         &nbsp;
                                         
                                     </td>
                                 </tr>
                                 <tr ID="itemPlaceholder" runat="server">
                                 </tr>
                             </table>
                         </div>
                         </td>
                     </LayoutTemplate>                              
                     <ItemTemplate>
                         <tr style="">
                             
                           
                             <td>
                                 <asp:Label ID="lblSched" runat="server" 
                                    Text='<%#Eval("SchedStartDateTime", "{0:D}")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblClient" runat="server" Text='<%#Eval("Client.FullName")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblService" runat="server" Text=' <%#Eval("ServicesLU.ServiceOffered")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblStart" runat="server" Text=' <%#Eval("SchedStart", "{0:t}")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblEnd" runat="server" Text=' <%#Eval("SchedEnd", "{0:t}")%>' />
                             </td>
                             
                           
                             <td align="center">
                                 <asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
                                 <asp:LinkButton ID="EditButton" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                             </td>
                             <td>
                                 <asp:LinkButton ID="LnkCreateService" runat="server" 
                                    CommandName="CreateService">Create Service</asp:LinkButton>
                                   
                             </td>
                         </tr>
                     </ItemTemplate>
                     <AlternatingItemTemplate>
                         <tr style="">
                             
                             <td>
                                 <asp:Label ID="lblSched" runat="server" 
                                     Text='<%#Eval("SchedStartDateTime", "{0:D}")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblClient" runat="server" 
                                     Text='<%#Eval("Client.FullName")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblService" runat="server" Text=' <%#Eval("ServicesLU.ServiceOffered")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblStart" runat="server" Text=' <%#Eval("SchedStart", "{0:t}")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblEnd" runat="server" Text=' <%#Eval("SchedEnd", "{0:t}")%>' />
                             </td>
                             
                             <td align="center">
                                 <asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
                                 <asp:LinkButton ID="EditButton" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                             </td>
                             <td>
                                 <asp:LinkButton ID="LnkCreateService" runat="server" 
                                    CommandName="CreateService">Create Service</asp:LinkButton>
                             </td>
                         </tr>
                     </AlternatingItemTemplate>
                     <EmptyDataTemplate>
                         <table ID="Table1" runat="server" style="">
                             <tr>
                                 <td>
                                     <asp:Label ID="Label14" runat="server" Text=" No schedules assigned for the day."></asp:Label>
                                    </td>
                             </tr>
                         </table>
                     </EmptyDataTemplate>
                     <SelectedItemTemplate>
                         <tr style="">
                             
                             
                             <td>
                                 <asp:Label ID="lblSched" runat="server" 
                                    Text='<%#Eval("SchedStartDateTime", "{0:D}")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblClient" runat="server" Text='<%#Eval("Client.FullName")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblService" runat="server" Text=' <%#Eval("ServicesLU.ServiceOffered")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblStart" runat="server" Text=' <%#Eval("SchedStart", "{0:t}")%>' />
                             </td>
                             <td>
                                 <asp:Label ID="lblEnd" runat="server" Text=' <%#Eval("SchedEnd", "{0:t}")%>' />
                             </td>
                             
                             
                             <td align="center">
                                 <asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
                                 <asp:LinkButton ID="EditButton" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                             </td>
                             <td>
                                 <asp:LinkButton ID="LnkCreateService" runat="server" 
                                    CommandName="CreateService">Create Service</asp:LinkButton>
                             </td>
                         </tr>
                     </SelectedItemTemplate>
                     <InsertItemTemplate>
                         <tr style="">
                            
                             
                             
                             <td valign="top">
                                   <asp:TextBox ID="txtCalendarIns" runat="server" 
                                      Text='<%# Bind("SchedStartDateTime") %>' Width="75%"></asp:TextBox>
                                   <img ID="ClickCalIns" alt="" src="../images2020/Calendar2.jpg" 
                                      style="vertical-align:bottom" />
                                   <asp:CalendarExtender ID="CalendarExtender1" runat="server" Enabled="True" 
                                      PopupButtonID="ClickCalIns" TargetControlID="txtCalendarIns">
                                   </asp:CalendarExtender>
                             </td>
                             
                             
                             
                             <td valign="top">
                                 <asp:DropDownList ID="ddClientIns" runat="server" AppendDataBoundItems="true" 
                                    DataSourceID="lnqClientSchedule" DataTextField="FullName" 
                                    DataValueField="CustomerID" Width="95%">
                                    <asp:ListItem Selected="True" Value="-1">
                                       --- Select Client ---
                                    </asp:ListItem>
                                 </asp:DropDownList>

                             </td>                                      
                            
                             
                             
                             <td valign="top">
                                  <asp:DropDownList ID="ddServiceOfferedIns" runat="server" 
                                     DataSourceID="lnqServiceLUSchedule" DataTextField="ServiceOffered" 
                                     DataValueField="LUServiceID">
                                     <asp:ListItem Selected="True" Value="-1">
                                       --- Select Service ---
                                    </asp:ListItem>
                                  </asp:DropDownList>
                             </td>

                             
                             
                             <td valign="top">
                                 <asp:TextBox ID="txtStartTimeIns" runat="server" 
                                    Text='<%# Bind("SchedStart") %>' Width="95%"></asp:TextBox>
                             </td>

                             
                             
                             <td valign="top">
                                   <asp:TextBox ID="txtEndTimeIns" runat="server" Text='<%# Bind("SchedEnd") %>' 
                                      Width="95%"></asp:TextBox>
                             </td>

                             
                             
                             <td valign="top" align="center">
                                 <asp:LinkButton ID="LnkInsertButton" runat="server" causesvalidation="true" 
                                    CommandName="Insert">Insert</asp:LinkButton>
                                 <asp:LinkButton ID="LnkCancelButton" runat="server" CommandName="Cancel">Clear</asp:LinkButton>
                             </td>

                             
                             
                             <td valign="top">
                                <asp:Label ID="Label15" runat="server" Text="Not Available"></asp:Label>
                                                                       
                             </td>

                             
                         </tr>
                     </InsertItemTemplate>

                     <EditItemTemplate>
                         <tr style="">
                             
                            <td valign="top">
                                   <asp:TextBox ID="txtCalendarUp" Width="75%" runat="server" Text='<%# Bind("SchedStartDateTime") %>' ></asp:TextBox>
                                  <img style="vertical-align:bottom" alt="" id="ClickCalUp" src="../images2020/Calendar2.jpg" />
                                 <asp:CalendarExtender ID="CalendarExtender1" TargetControlID="txtCalendarUp"
                                  runat="server" PopupButtonID="ClickCalUp" Enabled="True" ></asp:CalendarExtender>
                             </td>
                             
                             <td valign="top">
                                 <asp:DropDownList ID="ddClientUp" runat="server" DataSourceID="lnqClientSchedule"
                                  DataTextField="FullName" DataValueField="CustomerID" AppendDataBoundItems="true" >
                                       <asp:ListItem Value="-1" Selected="True">
                                       --- Select Client ---
                                    </asp:ListItem>
                                 </asp:DropDownList>

                             </td>                                      
                             <td valign="top">
                                  <asp:DropDownList ID="ddServiceOfferedUp" runat="server"  DataSourceID="lnqServiceLUSchedule"
                                    DataTextField="ServiceOffered" DataValueField="LUServiceID" >
                                        <asp:ListItem Value="-1" Selected="True">
                                       --- Select Service ---
                                    </asp:ListItem>
                    
                                     </asp:DropDownList>
                             </td>
                             <td valign="top">
                                 <asp:TextBox ID="txtStartTimeUp" Width="95%" runat="server" Text='<%# Bind("SchedStart") %>' ></asp:TextBox>
                             </td>
                             <td valign="top">
                                   <asp:TextBox ID="txtEndTimeUp" Width="95%" runat="server" Text='<%# Bind("SchedEnd") %>' ></asp:TextBox>
                             </td>
                             <td align="center" valign="top">
                                 <asp:LinkButton ID="LnkUpdateButton" runat="server"  causesvalidation="true" 
                                    CommandName="Update">Update</asp:LinkButton>
                                 <asp:LinkButton ID="LnkCancelButton" runat="server" CommandName="Cancel">Clear</asp:LinkButton>
                             </td>
                             <td>
                              <asp:Label ID="Label15" runat="server" Text=""></asp:Label> 
                             
                             </td>
                         </tr>
                     </EditItemTemplate>

                 </asp:ListView>
                     <asp:LinqDataSource ID="lnqSchedules" runat="server" 
                        ContextTypeName="Service2020.SalonDataClassesDataContext" EnableDelete="True" 
                        OrderBy="SchedStartDateTime, CustomerID" TableName="Schedules" 
                        Where="UserID == @UserID &amp;&amp; SchedStartDateTime.date == @SchedStartDateTime" 
                        EnableInsert="True" EnableUpdate="True">
                        <WhereParameters>
                           <asp:SessionParameter DbType="Guid" Name="UserID" SessionField="UserID" />
                           <asp:ControlParameter ControlID="hiCalendar" Name="SchedStartDateTime" 
                              PropertyName="Value" Type="DateTime" />
                        </WhereParameters>
                     </asp:LinqDataSource>
                     
                     <asp:LinqDataSource ID="lnqClientSchedule" runat="server" 
                        ContextTypeName="Service2020.SalonDataClassesDataContext" OrderBy="FullName" 
                        TableName="Clients" Where="UserID == @UserID">
                        <WhereParameters>
                           <asp:SessionParameter DbType="Guid" Name="UserID" SessionField="UserID" />
                        </WhereParameters>
                     </asp:LinqDataSource>
                     <asp:LinqDataSource ID="lnqServiceLUSchedule" runat="server" 
                        ContextTypeName="Service2020.SalonDataClassesDataContext" 
                        OrderBy="ServiceOffered" TableName="ServicesLUs" Where="UserID == @UserID">
                        <WhereParameters>
                           <asp:SessionParameter DbType="Guid" Name="UserID" SessionField="UserID" />
                        </WhereParameters>
                     </asp:LinqDataSource>

Open in new window

0
Comment
Question by:Sheritlw
  • 5
  • 3
9 Comments
 
LVL 14

Assisted Solution

by:robasta
robasta earned 150 total points
ID: 35163986
not the exact solution, but this article discusses your scenario: http://coderaptor.wordpress.com/2007/08/16/inserting-new-records-with-the-listview-linqdatasource/
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 350 total points
ID: 35176985
See if this helps (uses e.item.findcontrol)

http://forums.asp.net/t/1234587.aspx
0
 

Author Comment

by:Sheritlw
ID: 35177787
Hi,

I did try e.item.findcontrol... I have another listview that won't see the backend.  I get errors like this...

An unhandled exception occurred:
Message: C:\Users\depot\Documents\Visual Studio 2008\Projects\Service2020\Service2020\Stylist\Manage_Portfolio.aspx(99): error BC30390: 'Service2020.Manage_Portfolio.Private Sub lstBeforeAfter_ItemDeleting(sender As Object, e As System.Web.UI.WebControls.ListViewDeleteEventArgs)' is not accessible in this context because it is 'Private'.


This is the listviews own event.   I bind the listview in code behind, but have done this before.
The only thing I have done different recently is take viewstate off a lot of controls (i.e. tables, lists, grids etc.)

What is going on?

Thanks
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35179091
Is this listview inside some other container? Is the listview declared within Manage_Portfolio.aspx page?

A quick fix would be to change the "Private Sub" to "Public Sub"
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:Sheritlw
ID: 35194486
Sorry for not getting back sooner... had to drive more than 12 hours to get back home.

The manage_portfolio.aspx page is not in any container besides the master page.  
I just tried changing the listview events to public and it still does not react to it's own events.

What is going on... HELP!

Thanks
0
 

Author Comment

by:Sheritlw
ID: 35194531
Thought I'd include all the aspx code.
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Stylist/Stylist.master" CodeBehind="Manage_Portfolio.aspx.vb" Inherits="Service2020.Manage_Portfolio" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

   <link href="../CSS/ListViewGrids.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<div>
<table class="gridlistviewtables" enableviewstate="false">
<tr>
   <td colspan="2">
       &nbsp;
   </td>
</tr>

<tr>
   <td colspan="2" class="largetitle">
   
      Manage Portfolio
   </td>
   
</tr>
<tr>
   <td colspan="2" align="center">
       &nbsp;
   </td>
</tr>
<tr>
   <td>
      Upload Before Picture
   
   </td>
   <td>
      Upload After Picture
   </td>
</tr>
<tr>
   <td align="center">
      <asp:Image ID="imgUpBefore" runat="server" />
   </td>
   <td align="center">
      <asp:Image ID="imgUpAfter" runat="server" />
   </td>
</tr>
<tr>
   <td align="left">
      <asp:FileUpload ID="fuBeforePhoto" runat="server" />
      <asp:Label ID="lblBeforePhotoThumb" runat="server" Visible="false" Text=""></asp:Label>
      <asp:Label ID="lblBeforePhotoReg" runat="server" Visible="false" Text=""></asp:Label>
   </td>
   <td align="left">
      <asp:FileUpload ID="fuAfterPhoto" runat="server" />
      <asp:Label ID="lblAfterPhotoThumb" runat="server" Visible="false" Text=""></asp:Label>
      <asp:Label ID="lblAfterPhotoReg" runat="server" Visible="false" Text=""></asp:Label>
   </td>
</tr>
<tr>
   <td>
      Before Picture Title:
   </td>
   <td>
    After Picture Title:
   </td>
</tr>
<tr>
   <td>
      <asp:TextBox ID="txtBeforeName" Text="Before" Width="95%" runat="server"></asp:TextBox>
   </td>
   <td>
      <asp:TextBox ID="txtAfterName" Text="After" Width="95%" runat="server"></asp:TextBox>
   </td>
</tr>
<tr>
   <td align="center">
     <asp:Button ID="buttBeforePhoto" runat="server" Text="Upload Picture" />
   
   </td>
   <td align="center">
     <asp:Button ID="buttAfterPhoto" runat="server" Text="Upload Picture" />
   </td>
</tr>
<tr>
   <td colspan="2" align="center">
         <asp:Button ID="buttSaveUploads" BackColor="Purple" ForeColor="White" Font-Bold="true" runat="server" Text="Click to Save Before/After Photos to list" />

       &nbsp;
   </td>
</tr>
<tr>
   <td colspan="2">

       &nbsp;
   </td>
</tr>
<tr>
  
<td colspan="2" >
<asp:ListView ID="lstBeforeAfter" runat="server"  enableviewstate="false"
       DataKeyNames="PortfolioID" OnItemDeleting="lstBeforeAfter_ItemDeleting" 
       InsertItemPosition="None">
       <LayoutTemplate>
       <div style="width:98%">
           <table ID="itemPlaceholderContainer" runat="server" cellpadding="2" 
               class="ListViewTable" style="vertical-align:top">
               <tr ID="Tr1" runat="server">
                     <td class="ListViewHeader" style="width:40%">
                       <asp:Label ID="lblCat" runat="server" Text="Before Picture"></asp:Label>
                       
                   </td>

                   <td class="ListViewHeader" style="width:40%">
                       <asp:Label ID="Label23" runat="server" Text="After Picture"></asp:Label>
                     
                   </td>
                    <td class="ListViewHeader" >
                        &nbsp;
                       </td> 
               </tr>
               <tr ID="itemPlaceholder" runat="server">
               </tr>
           </table>
       </div>
       </td>
   </LayoutTemplate>     
                       
   <ItemTemplate>
       <tr style="">

           <td align="center" style="border: solid 5px #b9d0ff">
               <asp:Image runat="server" ID="imgBefore" ImageUrl='<%# Eval("BeforeImageThumb") %>' />
              <br /><asp:Label ID="lblBefore"  Width="95%" runat="server" Text='<%# Eval("BeforeImageName") %>'></asp:Label>
            </td>
           <td align="center" style="border: solid 5px #b9d0ff">
              <asp:Image  runat="server" ID="imgAfter" ImageUrl='<%# Eval("BeforeImagePath") %>' />
              <br /><asp:Label ID="lblAfter" Width="95%" runat="server" Text='<%# Eval("AfterImageName") %>'></asp:Label>
           </td>
           <td align="center" valign="middle" style="border: solid 5px #b9d0ff">
               <asp:LinkButton ID="DeleteButton" CommandName="Delete" runat="server" onclick="lstBeforeAfter_ItemCommand" 
               Text="Delete" ></asp:LinkButton>
           

           </td>
       </tr>
   </ItemTemplate>
   <AlternatingItemTemplate>
          <tr style="">
          
           <td align="center" style="border: solid 5px #b9d0ff">
               <asp:Image CssClass="Timg" runat="server" ID="imgBefore" ImageUrl='<%# Eval("BeforeImagePath") %>' />
              <br /><asp:Label ID="lblBefore" Width="95%" runat="server" Text='<%# Eval("BeforeImageName") %>'></asp:Label>
           </td>
           <td align="center" style="border: solid 5px #b9d0ff">
              <asp:Image CssClass="Timg" runat="server" ID="imgAfter" ImageUrl='<%# Eval("BeforeImagePath") %>' />
              <br /><asp:Label ID="lblAfter" Width="95%" runat="server" Text='<%# Eval("AfterImageName") %>'></asp:Label>
           </td>
           <td align="center"  valign="middle" style="border: solid 5px #b9d0ff">
               <asp:LinkButton ID="DeleteButton" CommandName="Delete" runat="server" onclick="lstBeforeAfter_ItemCommand" 
               Text="Delete" ></asp:LinkButton>
           </td>
       </tr>
   </AlternatingItemTemplate>
   <EmptyDataTemplate>
       <table ID="Table1" runat="server" style="">
           <tr>
               <td>
                   <asp:Label ID="Label21" runat="server" Text="There are no products that need to be ordered at this time."></asp:Label>
                  </td>
           </tr>
       </table>
   </EmptyDataTemplate>
                                
   <SelectedItemTemplate>
       <tr style="">
           <td align="center" style="border: solid 5px #b9d0ff">
               <asp:Image CssClass="Timg" runat="server" ID="imgBefore" ImageUrl='<%# Eval("BeforeImagePath") %>' />
              <br /><asp:Label ID="lblBefore" Width="95%" runat="server" Text='<%# Eval("BeforeImageName") %>'></asp:Label>
           </td>
           <td align="center" style="border: solid 5px #b9d0ff">
              <asp:Image CssClass="Timg" runat="server" ID="imgAfter" ImageUrl='<%# Eval("BeforeImagePath") %>' />
              <br /><asp:Label ID="lblAfter" Width="95%" runat="server" Text='<%# Eval("AfterImageName") %>'></asp:Label>
           </td>

            <td align="center" valign="middle" style="border: solid 5px #b9d0ff">
               <asp:LinkButton ID="DeleteButton" CommandName="Delete" runat="server" onclick="lstBeforeAfter_ItemCommand" 
               Text="Delete" ></asp:LinkButton>
           </td>
       </tr>
   </SelectedItemTemplate>
   
  
  </asp:ListView>


</td>

</tr>

  
 </table>
</div>

</asp:Content>

Open in new window

0
 

Accepted Solution

by:
Sheritlw earned 0 total points
ID: 35222053
Well I finally figured it out.  I had the tab control enableviewstate=false, once I changed to true, it worked.

Thanks for your help.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35230660
Glad you got it working :-)
0
 

Author Closing Comment

by:Sheritlw
ID: 35275216
I found and posted solution
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Split in Javascript 5 31
Automated testing suggestions? 2 29
Get the selected ValueMember of Combobox 5 23
ASP.NET MVC 2 6
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now