locked
null value in view state RRS feed

  • Question

  • User639567535 posted

    i try to fetch report on update click button .. there is several records in gridview

    i try this code

     Session["FormID"] = Convert.ToString(((ASPxGridView)sender).GetRowValues(index, "FormID"));
     else if(e.CallbackName == "UPDATEEDIT")
                {
                    DateTime DateT = Convert.ToDateTime(null);
               
                    if (ViewState["DateTime"] != null)
                    {
                       DateT = (DateTime)ViewState["DateTime"];
                    }
    
                   
                    VehId = (string)ViewState["VID"];
                    _sys = new clsDe_ComplainMaster();
                     dtUpdated = _sys.SelectUpdatedNRtype(ViewState["FFID"].ToString(),VehId,DateT);
                   }
    
    
    
    
                    
                    string VehId = (string)ViewState["VID"];
                    _sys = new clsDe_ComplainMaster();
                    DataTable dtUpdated = _sys.SelectUpdatedNRtype(ViewState["FormID"].ToString(), VehId, DateT);
    

    but in this line this pass null value in form id

    Session["FormID"] = Convert.ToString(((ASPxGridView)sender).GetRowValues(index, "FormID"));

    and i dont want null value .. i want some value in this id e.g.1233 or may be something

    how i solve it

    Thursday, April 28, 2016 7:23 AM

Answers

  • User-271186128 posted

    Hi Bakhtawar,

    You can set a break point to debug your code and make sure the index is not null.

    Besides, I suggest you could refer to the following code to get cell value from ASPxGridView

              ASPxTextBox txtBox1 = (ASPxTextBox)ASPxGridView1.FindRowCellTemplateControl(i, column1, "txtBox");
                ASPxTextBox txtBox2 = (ASPxTextBox)ASPxGridView1.FindRowCellTemplateControl(i, column2, "txtBox");
                if (txtBox1 == null || txtBox2 == null)
                    continue;
                int id = Convert.ToInt32(ASPxGridView1.GetRowValues(i, ASPxGridView1.KeyFieldName));
                list.Add(new Record(id, txtBox1.Text, txtBox2.Text));

    More details, see: https://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridView_GetRowValuestopic

    As PaulTheSmith said, since, this issue is related to DevExpress component, you can post your problem to DevExpress forum:

    https://www.devexpress.com/Support/Center/

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 28, 2016 10:46 AM

All replies

  • User303363814 posted

    It seems that you are asking a question about a DevExpress component.  You might get better answers asking in a DevExpress forum.

    This is a Microsoft forum concerned with C# language issues.

    Thursday, April 28, 2016 8:17 AM
  • User-271186128 posted

    Hi Bakhtawar,

    You can set a break point to debug your code and make sure the index is not null.

    Besides, I suggest you could refer to the following code to get cell value from ASPxGridView

              ASPxTextBox txtBox1 = (ASPxTextBox)ASPxGridView1.FindRowCellTemplateControl(i, column1, "txtBox");
                ASPxTextBox txtBox2 = (ASPxTextBox)ASPxGridView1.FindRowCellTemplateControl(i, column2, "txtBox");
                if (txtBox1 == null || txtBox2 == null)
                    continue;
                int id = Convert.ToInt32(ASPxGridView1.GetRowValues(i, ASPxGridView1.KeyFieldName));
                list.Add(new Record(id, txtBox1.Text, txtBox2.Text));

    More details, see: https://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridView_GetRowValuestopic

    As PaulTheSmith said, since, this issue is related to DevExpress component, you can post your problem to DevExpress forum:

    https://www.devexpress.com/Support/Center/

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 28, 2016 10:46 AM