Skip to main content

Command Name and Command Argument. in gridview and rowcommand

Command Name and Command Argument.

.aspx page

<ItemTemplate>                                     
<asp:LinkButton ID="lnkCopyBooking" runat="server" Text='Copy' CommandArgument='<%# Eval("Id")  %>'
CommandName='<%# COPYBOOKING %>' PostBackUrl="~/UI/FFShipmentAdd.aspx"></asp:LinkButton>
</ItemTemplate>

.CS page

 protected void grdBookingSent_RowCommand(object sender, CommandEventArgs e)
        {
         

            if (e.CommandName == ShowDetails)
            {
                this.Id = Convert.ToInt64(e.CommandArgument);
            }
            if (e.CommandName == COPYBOOKING)
            {
                this.Id = Convert.ToInt64(e.CommandArgument);
                this.Action = ActionMode.Create;
            }
        }



2->

protected void grdBookingRecievedShipper_RowCommand(object sender, CommandEventArgs e)
        {
            if (e.CommandName == ShowDetails)
            {
                this.Id = Convert.ToInt64(e.CommandArgument.ToString().Split(',')[0]);
                this.CurrrJobStatus = Convert.ToString(e.CommandArgument.ToString().Split(',')[1]);
            }
            if (e.CommandName == ShowCargoCondition)
            {
                this.Id = Convert.ToInt64(e.CommandArgument);
            }
            if (e.CommandName == COPYBOOKING)
            {
                this.Id = Convert.ToInt64(e.CommandArgument);
                this.Action = ActionMode.Create;
            }



            if (e.CommandName == SHOWBOOKINGOTHERDETAILS)
            {
                this.Id = Convert.ToInt64(e.CommandArgument);

            }

        }

Popular posts from this blog

Add barcode on pdf

using System; using System.IO; using System.Drawing; using ZXing; using iTextSharp.text; using iTextSharp.text.pdf; using System.Drawing; using System.Web.UI.WebControls; namespace PDFBarcode {     public partial class WebForm1 : System.Web.UI.Page     {         byte[] byteImage;         protected void Page_Load(object sender, EventArgs e)         {         }         protected void btnDownload_Click(object sender, EventArgs e)         {                       Random r = new Random();             string fileName = r.Next().ToString();             string filenameext = fileName + ".pdf";             GenerateBarcode(fileName);             string Sourcepath = Server.MapPath("~/SavedF...

Dynamic Menu in asp.net using Listview

 1.    public DataTable LoadMenu()         {             MenuBal MenuBal = new MenuBal();             DataSet ds = this.GetData(0);             PopulateMenu(ds);             return ds.Tables[2];         }     private DataSet GetData(int parentMenuId)         {             MenuBal objmenu = new MenuBal();             string Mode = "";             if (Session["Mode"] != null)             {                 Mode = Session["Mode"].ToString();             }             DataSet ds = objmenu.GetData(parentMenuId, Convert.ToInt32(SessionHelper.CurrentUserId), Mode, SessionHelper...