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

Unable to set selected row to edit mode from selected option in radwindowmanager

1 Answer 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dorababu
Top achievements
Rank 1
Dorababu asked on 25 Aug 2012, 06:20 AM
Hi all i have written a code to set selected row to edit mode when user selects yes from the radwindow. Here is my code

protected void rdbtnYes_Click(object sender, EventArgs e)
    {
        foreach (GridDataItem item in RadGrid2.MasterTableView.Items)
        {
            if (item.IsInEditMode && item is GridEditableItem)
            {
                if (item.OwnerTableView.IsItemInserted)
                {
                    item.Edit = true;
                }
            }
            //item.Edit = true;
        }
        RadGrid2.Rebind();
        rdwmdw1.Windows[0].VisibleOnPageLoad = false;
    }

This is my code for ItemDatabound event where I will show radiwnodw when necessary

protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
    {
        int iPagecount = RadGrid2.MasterTableView.CurrentPageIndex;
        if (e.Item is GridDataItem)
        {
            if (iPagecount == 0)
            {
                if (e.Item.ItemIndex != 0)
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];
                    imageButton.Visible = false;
                    //imageButton.ImageUrl = "images/MailOk.png";
                }
                else
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];
                    imageButton.Visible = true;
                }
            }
            else
            {
                GridDataItem item = (GridDataItem)e.Item;
                ImageButton imageButton = (ImageButton)item["imgEdit"].Controls[0];
                imageButton.Visible = false;
 
            }
        }
 
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            mlocal_strStoredProcName = StoredProcNames.Gender_uspGenderGetList;
            oEmployeePersonalData.Select(out mlocal_ds, mlocal_strStoredProcName);
            Label lblStatus = (Label)item.FindControl("lblApprovalStatus1");
            if (lblStatus.Text == "Y")
            {
                if (!e.Item.OwnerTableView.IsItemInserted)
                {
                    Label LBL1 = (Label)item.FindControl("lblMaritalStatus");
                    RadComboBox rdcmbGender = (RadComboBox)item.FindControl("rdcbGender");
                    rdcmbGender.DataSource = mlocal_ds;
                    rdcmbGender.DataTextField = TablesAndColumns.tblGender_GenderDesc;
                    rdcmbGender.DataValueField = TablesAndColumns.tblGender_GenderTypeID;
                    rdcmbGender.SelectedValue = (string)DataBinder.Eval(e.Item.DataItem, "MaritalTypeID").ToString();
                    //rdcmbGender.SelectedValue = LBL1.Text;
                    rdcmbGender.DataBind();
 
                    mlocal_strStoredProcName = USADAO.StoredProcNames.PayFrequency_uspPayFrequencySelect;
                    oEmployee.FedTaxID = Session["FedTaxID"].ToString();
                    oEmployee.Select(out mlocal_ds, mlocal_strStoredProcName);
                    RadComboBox ddlPayFrequencytype = (RadComboBox)item.FindControl("rdcbPayFrequency");
                    ddlPayFrequencytype.DataSource = mlocal_ds;
                    ddlPayFrequencytype.DataTextField = "PayFrequencyDesc";
                    ddlPayFrequencytype.DataValueField = "PayFrequencyType";
                    ddlPayFrequencytype.DataBind();
                    ddlPayFrequencytype.Enabled = false;
                    mlocal_ds.Clear();
                    RadDatePicker radDtStartDate = item.FindControl("radDtStartDate") as RadDatePicker;
                    RadDatePicker radDtEndDate = item.FindControl("radDtEndDate") as RadDatePicker;
 
                    strDate = radDtStartDate.SelectedDate.Value;
                    EndDt = radDtEndDate.SelectedDate.Value;
                }
            }
            else
            {
                e.Item.Edit = false;
                rdwmdw1.Windows[0].VisibleOnPageLoad = true;
            }
        }
    }

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 29 Aug 2012, 08:18 AM
Hi Dorababu,

I suggest that we continue our conversation on the following thread to enable other users with similar issues to track more easily the discussion:
http://www.telerik.com/community/forums/aspnet-ajax/grid/return-bool-value-from-javascript.aspx

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Dorababu
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or