Hide Ajax PopupControlExtender on Button click using javascript in Asp.net


Write the javascript function with the name HidePopup():
<script language="javascript" type="text/javascript">

function HidePopup() {
        
         $find('<%=PopupPstureGrip.ClientID%>').hidePopup();
         return false;
     }


</script>

Add Ajax PopupControlExtender control with some properties

<asp:PopupControlExtender ID="PopupPstureGrip"  runat="server" CommitProperty="value"   TargetControlID="txtposture" PopupControlID="PanelPostureGrip" Position="top" ></asp:PopupControlExtender>

Add asp.net Hide Button and call the javascript HidePopup() function in OnClientClick event

<asp:Button ID="btnCancel1" runat="server" Text="Cancel"   OnClientClick="HidePopup();"/>



How to Add an Image Commandfield to Gridview dynamically in asp.net


Adding Commandfield to Gridview dynamically in pageload with not IsPostBack

Add the following Namespace in the top for CommandField   :

using System.Web.UI.WebControls;

then
protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {
          CommandField   cmdfld = new CommandField();
           //Specify Image path
            cmdfld.SelectText = "<img src='./_images/EditIcon.gif'>";
            cmdfld.ShowSelectButton = true;
            cmdfld.HeaderText = "Edit";
            cmdfld.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
            GridView1.Columns.Add(cmdfld);
            GridView1.DataBind();

        }
    }




Create a Function in sqlserver 2008 to get Names from table by passing Ids as a Parameter:


The following is the Create function to get names by passing ids as a parameters.

CREATE FUNCTION GetNameById
(
    @id varchar(100)
)
RETURNS varchar(max)
AS
BEGIN
               
    declare @output varchar(max)
    select @output = COALESCE(@output + ', ', '') + Name
    from TableName
    where Id in (select * from Split(@id,','))

    return @output
END