How to put a GridView's row in edit mode, programatically?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ata@mailinator.com

    How to put a GridView's row in edit mode, programatically?

    Hi folks,
    I've got a LinkButton that's being added to the GridView under certain
    circumstances, conditionally.
    Whenever the link is clicked, I would like to put the row (that
    contains the link) in edit mode.
    Please note that I'm trying to do this dynamically, in the run-time.

    Any help would be highly appreciated,

    Thanks
    Jack
  • Riki

    #2
    Re: How to put a GridView's row in edit mode, programatically ?

    Just make sure that your linkbutton has the property CommandName="Ed it".

    --

    Riki

    <ata@mailinator .comwrote in message
    news:bc79fa6a-998f-453d-91e6-c37d1372413a@e5 3g2000hsa.googl egroups.com...
    Hi folks,
    I've got a LinkButton that's being added to the GridView under certain
    circumstances, conditionally.
    Whenever the link is clicked, I would like to put the row (that
    contains the link) in edit mode.
    Please note that I'm trying to do this dynamically, in the run-time.
    >
    Any help would be highly appreciated,
    >
    Thanks
    Jack

    Comment

    • ata@mailinator.com

      #3
      Re: How to put a GridView's row in edit mode, programatically ?

      On Jun 6, 8:43 pm, "Riki" <r...@dontnagme .comwrote:
      Just make sure that your linkbutton has the property CommandName="Ed it".
      >
      --
      >
      Riki
      >
      <a...@mailinato r.comwrote in message
      >
      news:bc79fa6a-998f-453d-91e6-c37d1372413a@e5 3g2000hsa.googl egroups.com...
      >
      Hi folks,
      I've got a LinkButton that's being added to the GridView under certain
      circumstances, conditionally.
      Whenever the link is clicked, I would like to put the row (that
      contains the link) in edit mode.
      Please note that I'm trying to do this dynamically, in the run-time.
      >
      Any help would be highly appreciated,
      >
      Thanks
      Jack
      But it doesn't make either.

      Comment

      • ata@mailinator.com

        #4
        Re: How to put a GridView's row in edit mode, programatically ?

        On Jun 6, 8:43 pm, "Riki" <r...@dontnagme .comwrote:
        Just make sure that your linkbutton has the property CommandName="Ed it".
        >
        --
        >
        Riki
        >
        <a...@mailinato r.comwrote in message
        >
        news:bc79fa6a-998f-453d-91e6-c37d1372413a@e5 3g2000hsa.googl egroups.com...
        >
        Hi folks,
        I've got a LinkButton that's being added to the GridView under certain
        circumstances, conditionally.
        Whenever the link is clicked, I would like to put the row (that
        contains the link) in edit mode.
        Please note that I'm trying to do this dynamically, in the run-time.
        >
        Any help would be highly appreciated,
        >
        Thanks
        Jack
        Well, I did so, but it doesn't work yet. Here's the code:

        LinkButton lblOptions = new LinkButton();
        lblOptions.Comm andName = "Edit";
        lblOptions.Caus esValidation = false;
        lblOptions.ID = "lblOptions " + id;
        lblOptions.Text = String.Format(" <span style='margin-left:10px;'></
        span>{0} other options", total);
        lblOptions.Styl e.Add(HtmlTextW riterStyle.Colo r, "black");
        lblOptions.Styl e.Add(HtmlTextW riterStyle.Font Weight, "bold");
        lblOptions.Styl e.Add(HtmlTextW riterStyle.Font Size, "7pt");

        row.Cells[3].Controls.Add(l blOptions);

        Pressing the link doesn't put the row in Edit mode!
        Any idea?

        Comment

        • ata@mailinator.com

          #5
          Re: How to put a GridView's row in edit mode, programatically ?

          On Jun 6, 9:29 pm, a...@mailinator .com wrote:
          On Jun 6, 8:43 pm, "Riki" <r...@dontnagme .comwrote:
          >
          >
          >
          Just make sure that your linkbutton has the property CommandName="Ed it".
          >
          --
          >
          Riki
          >
          <a...@mailinato r.comwrote in message
          >
          news:bc79fa6a-998f-453d-91e6-c37d1372413a@e5 3g2000hsa.googl egroups.com...
          >
          Hi folks,
          I've got a LinkButton that's being added to the GridView under certain
          circumstances, conditionally.
          Whenever the link is clicked, I would like to put the row (that
          contains the link) in edit mode.
          Please note that I'm trying to do this dynamically, in the run-time.
          >
          Any help would be highly appreciated,
          >
          Thanks
          Jack
          >
          Well, I did so, but it doesn't work yet. Here's the code:
          >
          LinkButton lblOptions = new LinkButton();
          lblOptions.Comm andName = "Edit";
          lblOptions.Caus esValidation = false;
          lblOptions.ID = "lblOptions " + id;
          lblOptions.Text = String.Format(" <span style='margin-left:10px;'></
          span>{0} other options", total);
          lblOptions.Styl e.Add(HtmlTextW riterStyle.Colo r, "black");
          lblOptions.Styl e.Add(HtmlTextW riterStyle.Font Weight, "bold");
          lblOptions.Styl e.Add(HtmlTextW riterStyle.Font Size, "7pt");
          >
          row.Cells[3].Controls.Add(l blOptions);
          >
          Pressing the link doesn't put the row in Edit mode!
          Any idea?
          WowI Actually find the problem. The link is created based
          e.Row.DataItem, in the RowCreated event handler.
          However, I've just noticed that when the link button is pressed, the
          RowCreated function gets called,
          but this time, e.Row.DataItem is null!!!!!!

          How this can be possible?

          Comment

          Working...