Click here to Skip to main content
13,191,124 members (66,464 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
<asp:Panel ID="Panel1" runat="server" CssClass="PanelPopup" style="display:block;width:500px;height:400px"  ScrollBars="Vertical">
 
<table>
<tr>
<td align="left" colspan="2" class="style1" style="height: 30px">
    <asp:Label ID="Label15" runat="server" Text="More Items"></asp:Label>
      <tr>
        <td align="left" colspan="5" valign="top" style="height: 6px">
         <img src="images/top_line_bg.jpg" style="height: 2px; width: 288px"> </img>
        </td>
       </tr>
 
</td>
</tr>
</table>
<table >
    <tr>
        <td class="popuplbltdwithpadding">
 
        </td>
        <td>
      </td>
    </tr>
    <tr>
    <td>
    <table>
    <tr>
    <td>
        <asp:GridView ID="grdparameter" runat="server" CellPadding="5"
            CssClass="CustomGrid" ShowFooter="True"
        AutoGenerateColumns="False" GridLines="Horizontal" AllowPaging="True"
            DataKeyNames="ParameterId" Width="249px"
        onselectedindexchanged="grdparameter_SelectedIndexChanged1"
        onpageindexchanging="grdparameter_PageIndexChanging" Height="16px"
            style="margin-right: 0px">
        <Columns>
        <asp:TemplateField>
        <ItemStyle CssClass="w" />
            <HeaderTemplate>
              <input id="chkAll" type="checkbox" onclick="javascript:SelectAllCheckboxes(this);" runat="server"/>
              <asp:Label ID="lblSelectAll" runat="server" Text="Select All" CssClass="grdheaderstyle"></asp:Label>
            </HeaderTemplate>
        <ItemTemplate>
            <asp:CheckBox ID="chkSelect" AutoPostBack="false" runat="server" />
        </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="ParameterName" HeaderText="Scheduled Items"
                                    ReadOnly="True" />
        </Columns>
        </asp:GridView>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
            CssClass="MiniInnerpageGrid" GridLines="Horizontal">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:ImageButton ID="Imageadd" runat="server" AlternateText="<%#Bind('ID')%>"
                            CssClass="icon" ImageUrl="~/images/HMS Buttons/icon1.jpg"
                            OnClick="Imageadd_Click" ToolTip="Copy" />
                    </ItemTemplate>
                    <ItemStyle CssClass="w" />
                </asp:TemplateField>
                <asp:BoundField DataField="Type" HeaderText="Type" />
                <asp:BoundField DataField="Medicine_Name" HeaderText="Medicine Name" />
                <asp:BoundField DataField="Dosage" HeaderText="Dosage" />
                <asp:BoundField DataField="No_Days" HeaderText="No Of Days" />
                <asp:BoundField DataField="DOV" HeaderText="DOV" />
            </Columns>
            <FooterStyle CssClass="GridFooter" />
            <HeaderStyle CssClass="grdheaderstyle" />
            <PagerStyle CssClass="GridFooter" />
            <RowStyle CssClass="grdrowstyle" />
        </asp:GridView>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
     <table >
    <tr>
      <td class="popuplbltdwithpadding">
          <asp:ImageButton ID="btnsaveparameter"
              ImageUrl="~/images/HMS Buttons/SaveHMS.jpg" runat="server" onclick="btnsaveparameter_Click"
               />
          </td>
       <td  class="popuplbltdwithpadding">
           <asp:ImageButton ID="ImageButton1" runat="server"
               ImageUrl="~/images/HMS Buttons/Close.jpg"/>
       </td>
      </tr>
    </table>
    <table>
</table>
</asp:Panel>
    <asp:Button ID="Button2" runat="server" Text="Button" style="display:none" />
    <asp:ModalPopupExtender ID="ModalPopup_Items" runat="server" TargetControlID="Button2" OnOkScript="btnsaveparameter_Click(object sender, ImageClickEventArgs e)" CancelControlID="ImageButton1" OkControlID="btnsaveparameter"
     ViewStateMode="Enabled" Drag="True" BackgroundCssClass="modalBackground"
    PopupControlID="Panel1" Enabled="True" DropShadow="True" DynamicServicePath="">
    </asp:ModalPopupExtender>

 protected void btnsaveparameter_Click(object sender, ImageClickEventArgs e)
        {
            //ImageButton b = (ImageButton)sender;
            //GridViewRow row = (GridViewRow)sender;
            //int rowIndex = row.RowIndex;
            foreach (GridViewRow row in GridView1.Rows)
            {
                CheckBox chk = (CheckBox)row.FindControl("chkSelect");
                if (chk.Checked)
                {
                    string ParameterId = grdcareplan.DataKeys[0].Value.ToString();
                    MySqlConnection StrConnection = null;
                    MySqlCommand StrCommand = null;
 
                    try
                    {
                        StrConnection = new MySqlConnection();
                        StrConnection.ConnectionString = StrConn;
                        StrConnection.Open();
 
                        StrCommand = new MySqlCommand();
                        StrCommand.CommandType = CommandType.StoredProcedure;
                        StrCommand.CommandText = "Insert_Parameter_Name";
                        StrCommand.Connection = StrConnection;
 

                        //StrCommand.Parameters.AddWithValue("_ParameterName", dropdowndisease.SelectedItem.Text);
                        StrCommand.Parameters.AddWithValue("_DiseaseId", Convert.ToInt32(ViewState["DiseaseId"]));
                        StrCommand.Parameters.AddWithValue("_ParameterId", ParameterId);
                        StrCommand.Parameters.AddWithValue("_Branch_Id", Convert.ToInt32(Session["Branchid"]));
                        StrCommand.Parameters.AddWithValue("_Tenant_Id", Convert.ToInt32(Session["Tenantid"]));
                        StrCommand.Parameters.AddWithValue("_Patient_Id", Convert.ToInt32(Session["DiagnosisClickId"]));
 

                        //  StrCommand.Parameters.AddWithValue("_Submit_Date", DateTime.Now);
 
                        StrCommand.ExecuteNonQuery();
                        BindCarePlan();
                        ModalPopupExtender1.Show();
                        Biomade.Visible = true;
                    }
 
                    catch (Exception ex)
                    {
                        obj.InfoEntry(DateTime.Now + "     " + "BtnSave1_Click" + "     " + "AccountBalance.aspx" + "     " + ex.Message, "");
                        obj.InfoEntry(DateTime.Now + "     " + ex.StackTrace, "");
                        Session["strerrormsg"] = DateTime.Now + "     " + "BtnSave1_Click" + "     " + "AccountBalance.aspx" + "     " + ex.Message;
                        Session["strerrortrace"] = DateTime.Now + "     " + ex.StackTrace;
                        Response.Redirect("ErrorPage.aspx");
                    }
                    finally
                    {
                        StrConnection.Close();
                        StrConnection.Dispose();
                    }
                }
            }
        }
   }

btnsaveparameter_Click" and ImageButton1 is not firing click event
Posted 11-Jan-13 18:37pm
ujali464
Updated 11-Jan-13 18:58pm
v4
Comments
Lakshmimsridhar 12-Jan-13 1:59am
   
try putting new buttons.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

there is not any problem on your given code. The code is running and postback event firing. Please, check another issue.
Thank you.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171016.2 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100