Monday, September 10, 2018

DATALIST EVENT HANDLING

Set Property of control 

<asp:DataList ID="dlstmovie" runat="server"   RepeatColumns="4"   

 RepeatDirection="Horizontal" Width="100%" CellPadding="4" CellSpacing="4"

 OnItemCommand="dlstmovie_ItemCommand">

 
<ItemTemplate>

<a href='<%#Eval("furl") %>' target="_blank">
 
<img alt="" src='/Admin/indexing/<%#Eval("fname") %>' style="height: 83px; width: 213px" />
               
</a>

 <asp:Label ID="Label1" Visible="false" runat="server" Text='<%#Eval("id") %>'>'></asp:Label>

  <asp:Button ID="but1" runat="server" Text="Edit" Width="220px" 

   CommandName="but1_Click"

  CssClass="contact-form" />

 </ItemTemplate>
 
</asp:DataList>


How to Handle Event 


 protected void dlstmovie_ItemCommand(object source, DataListCommandEventArgs e)
    {

        if (e.CommandName == "but1_Click") // check command is cmd_delete
        {

            Panel1.Visible = true;
            ModalPopupExtender1.Show();

            Label labid = (Label)e.Item.FindControl("Label1");
            txtid.Text = labid.Text;
            display();
        }
    }




No comments:

Post a Comment

GRIDVIEW ON ROW DATA BOUND EVENT

 Database Create  Student : roll , name , city , cost  Fix 6 Value  in Database Record  ====================================================...