Deepak Ratan

Deepak Ratan

  • NA
  • 175
  • 48.7k

The name 'DataList1' does not exist in the current context

Apr 13 2015 1:33 AM
ListViewVideo.aspx
 
<table>
          <tr>
               <td>
                     <ASPNetFlashVideo:FlashVideo ID="FlashVideo1" runat="server" Height="500" Width="1050"></ASPNetFlashVideo:FlashVideo>
                     <asp:FileUpload ID="FileUpload1" runat="server" CssClass="myButton" />
                     <asp:Button ID="btnupload" runat="server" Text="Upload" OnClick="btnupload_Click" CssClass="myButton" />
                     <hr />
                              <asp:DataList ID="DataList1" Visible="true" runat="server" AutoGenerateColumns="false" RepeatColumns="2" CellSpacing="5">
                                             <ItemTemplate>
                                                                        <u>
                                                                                <%# Eval("Name") %>
                                                                        </u>
                                                                        <a class="player" style="height:300px; width:300px; display:block" href='<%# Eval("Id","File.ashx?Id={0}") %>'>                                                                           </a>
                                           </ItemTemplate>
                            </asp:DataList>
               </td>
       </tr>
</table> 
 
 
ListViewVideo.aspx.cs
 
private void BindGrid()
         {
                  string strConnString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
                  using (SqlConnection con = new SqlConnection(strConnString))
                  {
                            using (SqlCommand cmd = new SqlCommand())
                           {
                                    cmd.CommandText = "select Id, Name from tblFiles";
                                    cmd.Connection = con;
                                    con.Open();
                                    DataList1.DataSource = cmd.ExecuteReader();
                                    DataList1.DataBind();
                                    con.Close();
                           }
                  }
         }
 
 
Hi,
       I am using LISTVIEW concept,In this i am displaying the Image in LISTVIEW 
      by clicking the Image the video will play using <href> tag
      Each image i am using separate video by ADD--> Existing Item--> SELECT VIDEO
      There is a problem  
      I am retrieving the video from database it should display in LISTVIEW
      <asp:DataList> tag ID is not showing in ListViewVideo.aspx.cs
      ANY SOLUTION.?
      HELP 
     
 

Answers (11)