Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7969551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:15:13+00:00 2026-06-04T07:15:13+00:00

I have a gridview in an update panel and it is working fine. However

  • 0

I have a gridview in an update panel and it is working fine. However on the click of the edit button I want to open the edit form. But the edit button click is not working. When i debug it, the method is working fine however the page doesn’t postback. I have tried using triggers but to no avail.

    <asp:UpdatePanel ID="upnlgrid" runat="server" UpdateMode="Conditional" >
    <ContentTemplate>
    <asp:GridView ID="gvGroupMaster" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanging="gvGroupMaster_SelectedIndexChanging" OnSelectedIndexChanged="gvGroupMaster_SelectedIndexChanged" OnRowDataBound="gvGroupMaster_RowDataBound"  AllowSorting="true" OnPageIndexChanging="gvGroupMaster_PageIndexChanging" OnSorting="gvGroupMaster_Sorting" 
ShowHeader="True" CssClass="tabledata" Width="100%" DataKeyNames="igroup_id">
                         <AlternatingRowStyle CssClass="pointer" />
<RowStyle CssClass="even pointer" />
<HeaderStyle CssClass="headings" />


                        <Columns>

                        <asp:TemplateField HeaderText="Sort Order" ItemStyle-CssClass="colmn1" SortExpression="isort_position" >
                           <ItemTemplate>
                          <%-- <asp:ImageButton ID="btnSort" OnClick="btnSortClick" imageurl="../images/order-sort-btnup.png" runat="server"></asp:ImageButton>--%>
           <asp:Button ID="btnSort" class="sortord pointer" runat="server" OnClick="btnSortClick" ></asp:Button>
           <asp:Button ID="btnSortDown" class="sortorddown pointer" runat="server" OnClick="btnSortDownClick"></asp:Button>


                             </ItemTemplate>
                            </asp:TemplateField>


                       <asp:TemplateField  HeaderText="Group Name" SortExpression="strgroup_name" ItemStyle-CssClass="colmn2" >

                            <ItemTemplate>
                            <asp:Label ID="lblGroupName" runat="server"
            Text='<%# Bind("strgroup_name") %>'></asp:Label>

                             </ItemTemplate>
                            </asp:TemplateField>



                             <asp:TemplateField HeaderText="Short Name" SortExpression="strgroup_sname" ItemStyle-CssClass="colmn3" >

                            <ItemTemplate>

                            <asp:Label ID="lblShortName" runat="server"
            Text='<%# Bind("strgroup_sname") %>'></asp:Label>


                            </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Under" SortExpression="iparent_id" ItemStyle-CssClass="colmn4">

                            <ItemTemplate>
                             <asp:Label ID="lblUnder" runat="server"
            Text='<%# Bind("strunder") %>'></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>


                             <asp:TemplateField HeaderText="Nature Of Group" SortExpression="strnature_of_group" ItemStyle-CssClass="colmn5">

                            <ItemTemplate>
                             <asp:Label ID="lblNatureOfGroup" runat="server"
            Text='<%# Bind("strnature_of_group") %>'></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>


                             <asp:TemplateField HeaderText="Affect Gross Profit" SortExpression="straffect_gross_profits" ItemStyle-CssClass="colmn6">

                            <ItemTemplate>

                             <asp:Label ID="lblAffectGrossProfits" runat="server" Text='<%# Bind("straffect_gross_profits") %>'></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>
                             <asp:TemplateField HeaderText="Nett DrCr Report" SortExpression="strnett_drcr_report"  ItemStyle-CssClass="colmn7">

                            <ItemTemplate>
                             <asp:Label ID="lblNettDrcrReport" runat="server"
            Text='<%# Bind("strnett_drcr_report") %>'></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>


                            <asp:TemplateField HeaderText="Created By" SortExpression="icreated_by"  ItemStyle-CssClass="colmn8">

                            <ItemTemplate>
                             <asp:Label ID="lblCreatedBy" runat="server"
            Text='<%# Bind("strcreated_by") %>'></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>


                             <asp:TemplateField HeaderText="Created On" SortExpression="dtcreated_on"  ItemStyle-CssClass="colmn9">

                            <ItemTemplate>
                             <asp:Label ID="lblCreatedOn" runat="server"
            Text='<%# Bind("dtcreated_on") %>'></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>



                             <asp:TemplateField HeaderText="Last Updated On" SortExpression="dtupdated_on" ItemStyle-CssClass="colmn10">
                            <ItemTemplate>
                             <asp:Label ID="lbLastUpdatedOn" runat="server"
            Text='<%# Bind("dtupdated_on") %>'></asp:Label>

                            </ItemTemplate>
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="Actions" ItemStyle-CssClass="colmn11">

                             <ItemTemplate>
                             <asp:Button id="btnInfo" runat="server" class="infoicon" Text='<%# Eval("igroup_id") %>'  OnClick="infoclick"/>
                             &nbsp;&nbsp;
                             <asp:Button id="btnEdit" runat="server" class="editicon"  CausesValidation="false" Text='<%# Eval("igroup_id") %>'  OnClick="editclick"/>
                            &nbsp;&nbsp;
                             <asp:Button id="btnDelete" runat="server" class="deleteicon" Text='<%# Eval("igroup_id") %>' OnClick="deleteclick"/>
                             </ItemTemplate>
                             </asp:TemplateField>
                        </Columns>



                    </asp:GridView>
                   </ContentTemplate>

  </asp:UpdatePanel>

codebehind for edit click

 protected void editclick(object sender, EventArgs e)
{
    try
    {

       //int rindex = (((GridViewRow)(((Button)(sender)).Parent.BindingContainer))).RowIndex;
        Button EditButton = (Button)gvGroupMaster.Rows[(((GridViewRow)(((Button)(sender)).Parent.BindingContainer))).RowIndex].FindControl("btnEdit");
        edit(EditButton.Text.ToString());
        this.Session["edit"] = EditButton.Text.ToString();

    }
    catch
    {
    }
}

protected void edit(string editid)
{
    try
    {
        GroupMasterClass gm = new GroupMasterClass();
        CompanyMasterClass co = new CompanyMasterClass();
        gm.igroup_id = Convert.ToInt32(editid);
        ResultClass objres = gm.fn_GetGroupByIdForEdit();
        if (objres.bStatus)
        {
            eslist<GroupMasterClass> OBJLIST = objres.objData as eslist<GroupMasterClass>;
            if (OBJLIST.Count > 0)
            {
                co.strcompany_code = Request.Cookies["userinfo"]["companycode"].ToString();
                ResultClass objress = co.fn_GetNameNumberStyle();
                if (objress.bStatus)
                {
                    eslist<CompanyMasterClass> OBJLISTS = objress.objData as eslist<CompanyMasterClass>;
                    if (OBJLISTS.Count > 0)
                    {
                        addfrm.Visible = true;
                        gridmain.Visible = false;
                        if (OBJLISTS[0].strname_style.ToString() == "PC")
                        {
                            txtGroupName.Text = misc.ToTitleCase(OBJLIST[0].strgroup_name);
                            txtGroupSname.Text = misc.ToTitleCase(OBJLIST[0].strgroup_sname);
                        }
                        if (OBJLISTS[0].strname_style.ToString() == "UC")
                        {
                            txtGroupName.Text = (OBJLIST[0].strgroup_name).ToUpper();
                            txtGroupSname.Text = (OBJLIST[0].strgroup_sname).ToUpper();
                            txtGroupName.Style.Add("text-transform", "uppercase");
                            txtGroupSname.Style.Add("text-transform", "uppercase");
                        }
                        if (OBJLISTS[0].strname_style.ToString() == "UG")
                        {
                            txtGroupName.Text = (OBJLIST[0].strgroup_name).ToUpper();
                            txtGroupSname.Text = (OBJLIST[0].strgroup_sname).ToUpper();
                        }
                    }
                }

                txtUnder.Text = OBJLIST[0].strunder;
                txtNotes.Text = OBJLIST[0].strnotes;
                for (int i = 0; i < OBJLIST.Count; i++)
                {
                    CompanyMasterClass cm = new CompanyMasterClass();
                    string p = OBJLIST[0].strcompany_code.ToString();
                    string t = string.Empty;
                    string code = string.Empty;
                    int count = 0;
                    string[] availcompanycode = p.Split(',');

                    foreach (string k in availcompanycode)
                    {
                        t = k.ToString();
                        code += "'" + t.ToString() + "'" + ",";

                        count++;
                    }
                    cm.strcompany_code = code.TrimEnd(',');

                    ResultClass objrest = cm.fn_GetCompanyListByCompanycode();

                    if (objres.bStatus)
                    {
                        eslist<CompanyMasterClass> OBJLISTS = objrest.objData as eslist<CompanyMasterClass>;
                        if (OBJLISTS.Count > 0)
                        {
                            // listboxsource.Items.Clear();
                            listboxdestination.DataTextField = "strcompany_name";
                            listboxdestination.DataValueField = "strcompany_code";
                            listboxdestination.DataSource = OBJLISTS;
                            listboxdestination.DataBind();
                        }
                    }



                    ListItem itemnature = new ListItem();
                    if (OBJLIST[i].strnature_of_group == "A")
                        itemnature.Text = "Assets";

                    else if (OBJLIST[i].strnature_of_group == "E")
                        itemnature.Text = "Expenses";
                    else if (OBJLIST[i].strnature_of_group == "I")
                        itemnature.Text = "Income";
                    else if (OBJLIST[i].strnature_of_group == "L")
                        itemnature.Text = "Liabilities";

                    // itemnature.Value = OBJLIST[i].igroup_id.ToString();

                    ddlNature.Items.Add(itemnature);


                    ListItem itemaffects = new ListItem();
                    if (OBJLIST[i].straffect_gross_profits == "N")
                        itemaffects.Text = "No";

                    else if (OBJLIST[i].straffect_gross_profits == "Y")
                        itemaffects.Text = "Yes";
                    //itemaffects.Value = OBJLIST[i].igroup_id.ToString();

                    ddlGrossProfit.Items.Add(itemaffects);

                    ListItem itemnett = new ListItem();
                    if (OBJLIST[i].strnett_drcr_report == "N")
                        itemnett.Text = "No";

                    else if (OBJLIST[i].strnett_drcr_report == "Y")
                        itemnett.Text = "Yes";
                    // itemnett.Value = OBJLIST[i].igroup_id.ToString();

                    ddlNett.Items.Add(itemnett);

                    ListItem itemlock = new ListItem();
                    if (OBJLIST[i].strlock_status == "N")
                        itemlock.Text = "No";

                    else if (OBJLIST[i].strlock_status == "Y")
                        itemlock.Text = "Yes";
                    // itemnett.Value = OBJLIST[i].igroup_id.ToString();

                    ddlNett.Items.Add(itemlock);

                }

            }
        }

    }
    catch
    {

    }
}

Any ideas?

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:15:14+00:00Added an answer on June 4, 2026 at 7:15 am

    Try using Button editbtn = (Button)sender; Rather than Button EditButton = (Button)gvGroupMaster.Rows[(((GridViewRow)(((Button)(sender)).Parent.BindingContainer))).RowIndex].FindControl("btnEdit");

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview inside an update panel, that is doing inline editing. When
I have a gridview with multiple rows, each has a Update button and I
I have a gridview in update panel and I am doing paging in that,
I have a gridview in an update panel and am using a jQuery dialog
I have a gridview in an update panel with the following code to select
i'm using an gridview inside the update panel.now in that grid i have 3
I've got a gridview inside an update panel. In the gridview I have an
I have a gridview inside an update panel.In that gridview, I have a linkbutton
I have an update panel and a gridview. Within the gridview i have a
I have a asp gridview with button field column on that button click I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.