Thursday, December 14, 2023

Multiple eval command argument in Linkbutton asp.net

  <asp:LinkButton ID="lnkgrdDraftPreliminaryEnquirySelect" runat="server" CssClass="btn btn-danger"  ToolTip="Select" CommandName="Select" Text="Select" CausesValidation="false" CommandArgument='<%# Eval("preliminaryenquiryid") + ";"+ Eval("TrackingId")%>' > </asp:LinkButton>


  protected void grdDraftPreliminaryEnquiry_RowCommand(object sender, GridViewCommandEventArgs e)

        {

            if (e.CommandName == "Select")

            {

                string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ';' });

                //int index = Convert.ToInt32(e.CommandArgument);

                //GridViewRow row = grdDraftPreliminaryEnquiry.Rows[5];

                //row.BackColor = Color.Yellow;


                int preliminaryEnquiryID = Convert.ToInt32(commandArgs[0]);

                UCPreliminaryInformation.FileID = Convert.ToInt32(commandArgs[1]);

}

}

reference:- https://www.codeguru.co.in/2008/09/how-to-pass-multiple-values-to.html

No comments:

Post a Comment