0
Answer

Rad Grid view in view state not working properly

Ask a question
pradeep kumar

pradeep kumar

12y
1.5k
1
I have a grid called location which is in viewstate once insert button is clicked inserting the actual value and while binding it takes previous data..!

this is my insert code
 GridEditFormItem inserteditem = e.Item as GridEditFormItem;

        RadComboBox ddllocation = (RadComboBox)inserteditem.FindControl("ddllocation") as RadComboBox;
        TextBox txtdisplayorder = (TextBox)inserteditem.FindControl("txtdisplayorder") as TextBox;
        try
        {
            int talkoftown_detailid = 1;
            if (ViewState["LocationGrid"] != null)
            {
                objtotdet = (List<TalkOfTheTown_Detail>)ViewState["LocationGrid"];
                talkoftown_detailid = objtotdet.Count + 1;
            }

            objTOTdetail.TalkOfTownDet_Id = talkoftown_detailid;
            objTOTdetail.PropLocation_Id = Convert.ToInt32(ddllocation.SelectedValue);
            objTOTdetail.DisplayOrder = Convert.ToInt16(txtdisplayorder.Text);

            objtotdet.Add(objTOTdetail);
            ViewState["LocationGrid"] = objtotdet;
            this.gvlocation.DataSource = objtotdet;
            this.gvlocation.DataBind();


need a immediate help..,
thanks..,