Click here to Skip to main content
13,189,324 members (67,301 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
protected void Imgbtnsave_Click(object sender, ImageClickEventArgs e)
        {
            
            MySqlConnection StrConnection = null;
            MySqlCommand StrCommand = null;
            
 

 
            try
            {
                StrConnection = new MySqlConnection();
                StrConnection.ConnectionString = StrConn;
                StrConnection.Open();
 
                StrCommand = new MySqlCommand();
                StrCommand.CommandType = CommandType.StoredProcedure;
                StrCommand.CommandText = "Select_LastDate_Result";
                StrCommand.Connection = StrConnection;
 
                StrCommand.Parameters.AddWithValue("_DiseaseId", ddlselectdisease.SelectedValue);
               
                StrCommand.Parameters.AddWithValue("_Branch_Id", 1);
                StrCommand.Parameters.AddWithValue("_Tenant_Id", 1);
                StrCommand.Parameters.AddWithValue("_Patient_Id", 1);
              
 
                StrCommand.ExecuteNonQuery();
                BindCarePlan();
            }
            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();
 

 

            }
          
        }
 

    }
i want to define ParameterId as Datakey value for this image button ...how i can i difine..syntax..
as we r defining like this
string ParameterId = Convert.ToString(grdcareplan.DataKeys[e.RowIndex].Value);

in edit delete functionality of gridview..
Posted 5-Jan-13 0:29am
ujali464
Updated 5-Jan-13 1:08am
v4
Comments
AshishChaudha 5-Jan-13 7:09am
   
didnt understand the question, please elaborate your question.

1 solution

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

Solution 1

Client Side
----------------
 
 <asp:GridView ID="grdCreateEdit" runat="server" DataKeyNames="ParameterId">
 </asp:GridView>
 

Server Side
----------------
int parameterId=0;
foreach (GridViewRow grdRow in grdCreateEdit.Rows)
{
  int.TryParse(grdCreateEdit.DataKeys[grdRow.RowIndex].Values[0].ToString(), out parameterId);
}
  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 5 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