Posts

Showing posts from February, 2014

How do I find the Client ID of control within an ASP.NET GridView?

<asp:TemplateField> <ItemTemplate> <asp:TextBox ID = "textDateSent" runat = "server" > </asp:TextBox> <input type="button" value='Today' onclick="setToday(' <% # ((GridViewRow)Container).FindControl("textDateSent").ClientID %>');" /> </ItemTemplate> </asp:TemplateField>

How to make eachcontrol inside update panel to readonly.

private static void DisableControl(System.Web.UI.Control control)         {             System.Reflection.PropertyInfo enProp = control.GetType().GetProperty("Enabled");             if (enProp != null)             {                 enProp.SetValue(control, false, null);             }             foreach (System.Web.UI.Control ctrl in control.Controls)             {                 DisableControl(ctrl);             }  ...

Delete gridview row inside repeater by javascript onclient click in asp.net

//Add this in c# code to add client event in button then write your delete code on repeater itemcommand protected void GrdImageDetail_RowDataBound(object sender, GridViewRowEventArgs e)         {             if (e.Row.RowType == DataControlRowType.DataRow)             {                 (e.Row.FindControl("lnkDelete") as LinkButton).OnClientClick = "return DeletegrdIndustrySplFiles('" + (rptAccordian.Items[e.Row.RowIndex].FindControl("GrdImageDetail")).ClientID + "','" + e.Row.RowIndex.ToString() + "');";             }         } //javascript to delete row from client side  function DeletegrdIndustrySplFiles(gridclientid, rowindex) {       ...