Friday, April 27, 2012

Attributes add for controls in gridview in asp.net with c#


   protected void dglistinner_ItemDataBound(object sender, DataGridItemEventArgs e)
    {
        try
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem | e.Item.ItemType == ListItemType.Item)
            {
              ImageButton lnk = new ImageButton();
                lnk = (ImageButton)e.Item.FindControl("img");
               lnk.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this Data?');");
            }
        }
        catch (Exception ex)
        {
        }
    }

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...