Click here to Skip to main content
Sign Up to vote bad
good
See more: C#
how do i get only specific value on a datalist i want to delete images i display on the datalist but i only want to delete a spefic image i have a label with the image id so i want to use the id as my peremeter
 
here is my code
 
<asp:DataList ID="DataList2" runat="server" DataKeyField="pid"
        DataSourceID="SqlDataSource2" RepeatColumns="3"
            onselectedindexchanged="DataList2_SelectedIndexChanged">
        <ItemTemplate>
            <asp:Label ID="pidLabel" runat="server" Text='<%# Eval("pid") %>' />
            <br />
            <asp:Image ID="Image1" runat="server"
                ImageUrl='<%# Eval("picurl","~/images/{0}") %>' BorderColor="Red"
                BorderStyle="Groove" Height="200px" Width="200px" /><br />
            uploadedby:
            <asp:Label ID="uploadedbyLabel" runat="server"
                Text='<%# Eval("uploadedby") %>' />
            <br />
            <br />
            <asp:Button ID="Button3" runat="server" Text="Delete"  OnClick = "btnPhotos_Click"/>
 
        </ItemTemplate>
    </asp:DataList>
Posted 14 Sep '12 - 3:02

Comments
Sandeep Mewara - 14 Sep '12 - 9:14
And what exactly is your problem? Where did you get stuck while trying it out? Share your code behind where you tried to do it.
Malli_S - 14 Sep '12 - 9:17
The question is not so clear. Add the exact description/details using 'Improve question' option.

1 solution

common delete scenario for datalist is as follows..
 
Sub Delete_Command(ByVal sender As Object, _
                       ByVal e As DataListCommandEventArgs)
        '---retrieves the key for the row that you want to delete---
        Response.Write(DataList1.DataKeys(e.Item.ItemIndex))
        '---codes to delete row here----
         End Sub
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 253
1 Rohan Leuva 220
2 Sergey Alexandrovich Kryukov 208
3 Abhinav S 168
4 Mahesh Bailwal 165
0 Sergey Alexandrovich Kryukov 8,494
1 OriginalGriff 6,799
2 CPallini 3,603
3 Rohan Leuva 2,923
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 14 Sep 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid