This is a migrated thread and some comments may be shown as answers.

Cant able to retrieve the Texbox value form the Webusercontrol when enable view state = false

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Puay Chai Tan
Top achievements
Rank 1
Puay Chai Tan asked on 26 Oct 2010, 10:02 AM
Hi,

Our application Structure is mentioned below:
1) Master Page  header part contains the Rad Menu. On Menu Click Navigates to the respective content page.
2) All our content pages contains the RadGrid
3) We are using WebUserControl for the RadGrid EditForm.
Ref : http://test.aptisys.com/UOMSetup.aspx

I implemented the example with the Need data source, similar to the below mentioned telerik URL, (You can check our url  example in   http://test.aptisys.com/UOMSetup.aspx for reference).

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/templateformupdate/defaultcs.aspx

Pls reply back to the below Query and send us some example samples:

 In the RadGrid disabled the EnableViewState="false", when i tried to read the value from the webusercontrol edit form from the code behind content page, while implementing the InsertCommand to insert uom_code, uom_name and uom_desc values returns the empty string from the web user control.
1) How to insert the value using the InsertCommand when the viewstate is set to false?
2) What is the syntex to retrieve value from the webusercontrol edit form to assign to the respective table column in the insert command method?
3) What is the workaround to overcome this problem? 
4) Could you please send us some example how to implement the need data source  to insert, update and delete command when enable view state is set to false?
5) If i implement the heirarchy grid using the Need Data Source with Web User Control as edit form and set the Enable view state = false, does the second level of the heirarchy grid supports Grouping, Sorting, Filtering? Could you please send us some example for the scenario implemented using the need data source with Enable View State is set to false?

 protected void RadGUOM_InsertCommand(object source, GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
        //Create new row in the DataSource
        DataRow newRow = this.UOMCode.NewRow();
        //Insert new values
        Hashtable newValues = new Hashtable();
        newValues["uom_code"] = (userControl.FindControl("txtUcode") as TextBox).Text; (*Returns empty string)
        newValues["uom_name"] = (userControl.FindControl("txtUName") as TextBox).Text;(*Returns empty string)
        newValues["uom_desc"] = (userControl.FindControl("txtUdesc") as TextBox).Text;(*Returns empty string)

        //make sure that unique primary key value is generated for the inserted row
     //   newValues["EmployeeID"] = (int)this.Employees.Rows[this.Employees.Rows.Count - 1]["EmployeeID"] + 1;
        try
        {
            foreach (DictionaryEntry entry in newValues)
            {
                newRow[(string)entry.Key] = entry.Value;
            }
            this.UOMCode.Rows.Add(newRow);
            this.UOMCode.AcceptChanges();

        }
        catch (Exception ex)
        {
            Label lblError = new Label();
            lblError.Text = "Unable to insert Employees. Reason: " + ex.Message;
            lblError.ForeColor = System.Drawing.Color.Red;
            RadGUOM.Controls.Add(lblError);

            e.Canceled = true;
        }
        //RadGUOM.DataSource = null;
        //RadGUOM.Rebind();

    }

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 28 Oct 2010, 12:31 PM
Hello Puay,

Our system indicates that you have opened a support ticket concerning the same issue. In order to avoid duplicate posts, I suggest that we continue the communication in the support ticket.

Sincerely yours,
Mira
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Puay Chai Tan
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or