DataGrid Row Disappears when click edit??

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default DataGrid Row Disappears when click edit??

    Hi,

    I have a datagrid DataBound with the following code:

    private void SampleSearch()
    {

    // set search strings
    int intUserNo = (int)(Session["usrNo"]);
    string strPatientCode = patientCodeTxtBx.Text;
    DateTime dateProcedureDate = DateTime.Parse(procedureDateTxtBx.Text);

    // set parameter values
    daSampleAss.SelectCommand.Parameters["@patientCode"].Value =
    strPatientCode;
    daSampleAss.SelectCommand.Parameters["@procedureDate"].Value =
    dateProcedureDate;
    daSampleAss.SelectCommand.Parameters["@usrNo"].Value = intUserNo;

    daSampleAss.Fill(dsSampleAss1);

    DataGrid1.DataBind();
    }

    Which works OK.

    But when I click the 'Edit' link in the first column, the headers
    remain but the row disappears. It's code is as follows:

    private void DataGrid1_EditCommand(object source,
    System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    DataGrid1.EditItemIndex = e.Item.ItemIndex;
    DataGrid1.DataBind();
    }

    DataGrid1 has DataSource = dsSampleAss1.

    Any ideas?

    Thanks.

    Assimalyst Guest

  2. Similar Questions and Discussions

    1. Would like to load a datagrid already in edit mode instead of having the user click the edit button
      Now my asp.net datagrid shows an edit button and clicking it puts the datagrid in edit mode. I would like to: 1) possilby load the page already...
    2. datalist disappears on edit bind
      Hi I have a simple datalist which displays a list of typenames. it will list from a datasource and let me add. But on the Edit bind the list...
    3. DataGrid disappears on UpdateCommand
      Hi, I'm using a DataGrid with dynmically created colums. (AutoGenerateColumns=false) I call the DataGrid creation and data binding if...
    4. DataGrid Disappears when I click on Edit
      In my test environment my datagrid is working is just fine. I have multiple template columns and I am not using paging. When I move the datagrid...
    5. DataGrid contains no data after postback of edit button click...
      This is specifically what is going on in my application:...
  3. #2

    Default Re: DataGrid Row Disappears when click edit??

    It seems after much messing that the problem may be to do with the fact
    that I have removed the if(!IsPostBack) code from the
    DataGrid1.DataBind().

    I created a test and it works ok if if(!IsPostBack) is included, and
    run from the Page_Load method.

    However I want to bnd the datagrid using a button click, in which case
    the datagrid does not bind due to if(!IsPostBack) being false. Is there
    anyway around this?

    Thanks.

    Assimalyst Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139