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

Whenever I clicked add new Record link in grid it is take long Time

1 Answer 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kannadasan
Top achievements
Rank 1
Kannadasan asked on 14 Jul 2010, 08:40 AM

Dear Team

I am Using telerik Rad grid in My Web application .I have some problem in click add new Record. Whenever I clicked add new Record link in grid it is take long Time. Why, I didn’t find .Please give a Good Solution.My Code Given Below..I am using Role Based Contion Checking in Code Behind..

  <div style="overflow: scroll; height: 245px;width:100%">

                                       <asp:UpdatePanel ID="UpdatePanel11" runat="server">

                                            <ContentTemplate>

                                                <table width="100%" style="margin-left: 10px">

                                                    <tr>

                                                        <td>

                                                            <telerik:RadGrid ID="radgridActivity" runat="server" Skin="Vista" Width="650px" Height="300px"

                                                                AutoGenerateColumns="False" Visible="true" AutoGenerateEditColumn="true"  ShowStatusBar="false" GridLines="None"  OnInsertCommand="Activity_InsertCommand" AllowPaging="True"

                                                                OnNeedDataSource="Activity_NeedDataSource" OnItemDataBound="radgridActivity_ItemDataBound"  OnItemCreated="radgridActivity_ItemCreated"

                                                                AllowSorting="True" PageSize="10" OnUpdateCommand="Activity_UpdateCommand" OnDeleteCommand="RadGridActivity_DeleteCommand" >

                                                                <MasterTableView  EditMode="PopUp" DataKeyNames="activityid" AutoGenerateColumns="false"  AllowSorting="true"  

                                                                    EditFormSettings-PopUpSettings-ScrollBars="Vertical" EditFormSettings-PopUpSettings-Height="200px">

Code Bind:

 protected void radgridActivity_ItemDataBound(object sender, GridItemEventArgs e)
        {


            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                GridEditManager editMan = editedItem.EditManager;
                GridTextBoxColumnEditor txtRate = (GridTextBoxColumnEditor)editedItem.EditManager.GetColumnEditor("Firstname");
                if (cmbCustomerId.Text != "Select a Client..")
                    txtRate.TextBoxControl.Text = cmbCustomerId.Text;
                TextBox CustomerName = editedItem["Firstname"].Controls[0] as TextBox;
                CustomerName.Enabled = false;
                TextBox ActStatus = editedItem["status"].Controls[0] as TextBox;
                ActStatus.Enabled = false;
                if (e.Item.DataSetIndex != -1)
                {
                    ((RadComboBox)e.Item.FindControl("RadComboBox1")).SelectedValue = (e.Item.DataItem as System.Data.DataRowView)["actiontype"].ToString();
                    ((RadComboBox)e.Item.FindControl("RadComboBox2")).SelectedValue = (e.Item.DataItem as System.Data.DataRowView)["nextactiontype"].ToString();

                    ((RadComboBox)e.Item.FindControl("cmbPriority")).SelectedValue = (e.Item.DataItem as System.Data.DataRowView)["Priority"].ToString();
                    ((RadComboBox)e.Item.FindControl("cmbActivityFor")).SelectedValue = (e.Item.DataItem as System.Data.DataRowView)["ActivityFor"].ToString();
                    ((RadComboBox)e.Item.FindControl("cmbScheduledFor")).SelectedValue = (e.Item.DataItem as System.Data.DataRowView)["ScheduledFor"].ToString();
                    ((RadComboBox)e.Item.FindControl("cmbScheduleBy")).SelectedValue = (e.Item.DataItem as System.Data.DataRowView)["ScheduleBy"].ToString();
                    ((RadComboBox)e.Item.FindControl("cmbRecurringFreq")).SelectedValue = (e.Item.DataItem as System.Data.DataRowView)["RecurringFreq"].ToString();
                }

            }


            if (e.Item is GridDataItem)
            {

                GridDataItem gridDataItem = (GridDataItem)e.Item;
                Hashtable values = new Hashtable();
                gridDataItem.ExtractValues(values);
                string status = values["status"].ToString();
                ImageButton btnDelete = gridDataItem["Delete"].Controls[0] as ImageButton;
                ImageButton btnEdit = gridDataItem["Edit"].Controls[0] as ImageButton;
                if (Session["sesUserType"].ToString() == "Sales Rep")
                {
                    if (status.Equals("Submitted"))
                    {
                        btnDelete.ImageUrl = "Styles/Images/DeleteBin1.gif";
                        btnDelete.Enabled = false;
                    }
                    else
                    {
                        btnDelete.ImageUrl = "Styles/Images/DeleteBin.gif";
                        btnDelete.Enabled = true;
                    }
                }
                else
                {
                    btnEdit.ImageUrl = "Styles/Images/EditWDT1.gif";
                    btnDelete.ImageUrl = "Styles/Images/DeleteBin1.gif";
                    btnDelete.Enabled = false;
                    btnEdit.Enabled = false;
                }


            }
        }

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 15 Jul 2010, 01:58 PM
Hello Kannadasan,

Could you paste your complete code and code behind - do use the code-formatter tool of the ticket editor to make the code readable.

Regards,
Tsvetoslav
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
Kannadasan
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or