call window pop up in Gridview RowCommand

Discussion in 'Software' started by Ahyoem, Dec 9, 2009.

  1. Ahyoem

    Ahyoem

    Joined:
    Dec 9, 2009
    Messages:
    4
    Hello

    I call window popup in Gridview RowCommand , when click , it not show popup , second time it show popup .
    How to do , I want to show popup in first time click.

    protected void gvtest_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
    LinkButton lnkcprid = (LinkButton)e.Row.FindControl("lnkcprid");
    GridViewRow gv = e.Row;
    string[] commandArgs = lnkcprid.CommandArgument.ToString().Split(new char[] { ',' });
    string cprID = commandArgs[0];
    string cprContractID = commandArgs[1];
    if (cprID != "0")
    {
    lnkcprid.Attributes.Add("onclick", "Openwin('" + cprID + "','" + cprContractID + "');return false;");
    }
    else
    {
    lnkcntrid.ForeColor = System.Drawing.Color.Red;
    }
    }
    }

    protected void gvtest_RowCommand(Object sender, GridViewCommandEventArgs e)
    {
    if (e.CommandName == "NEW")
    {
    string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
    string cprID = commandArgs[0];
    string cprContractID = commandArgs[1];
    LinkButton lnkcprid = (LinkButton)e.CommandSource;
    GridViewRow gvr = ((Control)e.CommandSource).Parent.Parent as GridViewRow;
    lbl.Text = gvr.RowIndex.ToString();
    cprID = "341700";
    lnkcprid.Attributes.Add("onclick", "Openwin('" + cprID + "','" + cprContractID + "');return false;");
    }
    }

    in Gridview rowcommand cprid will generate key. now I just insert example.
    Please help me , how to call window popup in gridview rowcommand.
     
    Ahyoem, Dec 9, 2009
    #1
    1. Advertising

  2. Ahyoem

    Ahyoem

    Joined:
    Dec 9, 2009
    Messages:
    4
    I am okay now
    I call javascript
    using
    Page.ClientScript.RegisterStartupScript(typeof(Page), funcname, jstr);
    instead of using
    lnkcprid.Attributes.Add("onclick", "Openwin('" + cprID + "','" + cprContractID + "');return false;");
     
    Ahyoem, Dec 9, 2009
    #2
    1. Advertising

  3. Ahyoem

    article

    Joined:
    Dec 9, 2009
    Messages:
    2
    Location:
    Hyderbad
    =================================

    =============================================
    Hi Velocity Team;
    call window popup in Gridview RowCommand
    Try This
    **********************************
    protected void gvAuditLog_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    try
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {

    string QueryStr = "QueryStr=" + gvAuditLog.DataKeys[e.Row.RowIndex].Value.ToString() + "," + e.Row.RowIndex.ToString();
    string PageName = Page.ResolveUrl(@"popup/ViewAuditlog.aspx?" + QueryStr);
    Session[e.Row.RowIndex.ToString()] = DataBinder.Eval(e.Row.DataItem, "Event_Time").ToString();

    //((LinkButton)(e.Row.FindControl("lbView"))).Attributes.Add("onclick", "window.open('" + PageName + "','Popup','width=810,height=250,top=120,left=120,scrollbars=yes,resizable=yes,location=no');return false;");
    ((LinkButton)(e.Row.FindControl("lbView"))).Attributes.Add("onclick", "PopupPic('" + PageName + "',810,500)");
    ((LinkButton)e.Row.FindControl("lbDelete")).Attributes.Add("onClick", "return confirm('Are you sure want to delete the AduitLOg Info.');");

    }// ((LinkButton)(e.Row.FindControl("lbView"))).Attributes.Add("onclick", " maxwin();");
    }
    catch (Exception ex)
    {
    lblmesg.Text= CommonShared.Error_Log(Request.UserHostAddress,ex);

    }

    }
    ===========
    Thank's
    Prasanta Kumar Pradhan
     
    article, Dec 9, 2009
    #3
  4. Ahyoem

    Ahyoem

    Joined:
    Dec 9, 2009
    Messages:
    4
    Thanks you
    it help me a lot
     
    Ahyoem, Dec 9, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ropio

    GridView not updating

    ropio, Jul 12, 2006, in forum: Software
    Replies:
    0
    Views:
    1,160
    ropio
    Jul 12, 2006
  2. jm1468

    Gridview mapping

    jm1468, Jul 26, 2006, in forum: Software
    Replies:
    0
    Views:
    1,073
    jm1468
    Jul 26, 2006
  3. aidoCo
    Replies:
    2
    Views:
    17,972
  4. Usman

    Update and Delete From Gridview

    Usman, Nov 1, 2006, in forum: Software
    Replies:
    0
    Views:
    5,700
    Usman
    Nov 1, 2006
  5. visj4u

    DropdownList in gridview

    visj4u, Apr 27, 2007, in forum: Software
    Replies:
    0
    Views:
    1,246
    visj4u
    Apr 27, 2007
Loading...

Share This Page