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

[Solved] Insert form button redisplays app ok, same form button in edit mode causes duplicate Gridheader display ...

9 Answers 254 Views
Grid
This is a migrated thread and some comments may be shown as answers.
IQworks
Top achievements
Rank 1
IQworks asked on 25 May 2009, 05:33 AM
Hi,
   I have an app (RADGRID, formtemplate) where I have a user defined button. I have the form is displayed with the button on the form.  Right now the only thing the button should do when I click it is to simply redisplay the form. This works ok when the form is in insert mode. But when it is in edit mode and I click the button, the app is redisplayed with the header portion being displayed twice, one on top of the other ............

Before Button pressed while in edit mode...                              After button pressed while in edit mode ...

GRIDHEADER                                                                           GRIDHEADER
COMMANDTEMPLATE                                                             COMMANDTEMPLATE
COLUMNHEADER                                                                     COLUMNHEADER
FORMTEMPLATE                                                                     GRIDHEADER
GRID                                                                                         COMMANDTEMPLATE
PAGER                                                                                      COLUMNHEADER
                                                                                                 FORMTEMPLATE
                                                                                                  GRID
                                                                                                  PAGER
  
   I am wondering what the edit mode is doing (maybe in itemcreated) that is not being done when the form is in edit mode ? Any place I can go to read up on the edit and insert form cycle ?

  thanks for your time

9 Answers, 1 is accepted

Sort by
0
IQworks
Top achievements
Rank 1
answered on 27 May 2009, 10:21 PM
To help clarify, I have put up an example on my server.
If you click on "Add New Equipment", the formtemplate will appear. Now when you click on the green plus sign next to the location background, the screen comes back just fine.
if you are in Edit mode (click one of the pencils) and the formtemplate appears and you click on the plus sign, now the header duplicates ....
Example for Telerik Support ...

Now, whats interesting is that I have this grid enclosed in an 

RadAjaxPanel

 

. I took off the RadAjaxPanel, and enclosed the grid in a traditional  

 

<

 

asp:UpdatePanel ID="UpdatePanel14" runat="server">

 

 

<ContentTemplate>

 

 

. Now, when I click on the green plus sign on the formtemplate during editing, I get the error :

"Sys.InvalidOperationException: A control is already associated with the element."

  After further research, I found some of these opinions.  
  

1) <asp:ScriptManager ID="ScriptManager1" ScriptMode="Release" runat="server">
</asp:ScriptManager>  - This does seem to eliminate the error in some casres.

2) The problem seemed to be caused by some AJAX elements, but how can I locate which one it is?
     (only used
3) removing the RequiredFieldValidators (did not work for me).

 

 

4) Is there a chance that you code is trying to add multiple controls to the same div (for example.
    (I do have two controls within a div, but this works when the formtemplate is displayed, and, in Inserf Mode when the green plus sign is pressed) 

In the js debug, this is what I got ... 

 

throw

 

Error.invalidOperation(Sys.Res.controlAlreadyDefined);
The res says "The PageRequestManager cannot be initialized more than once".
(Could this happen in edit mode and not insert mode ? )

 

 

This is what I have researched so far. 

thanks, as always for your time ..... 

   

0
Sebastian
Telerik team
answered on 28 May 2009, 07:34 AM

Hello IQworks,

Thank you for the detailed explanation.

It seems that in your particular case a duplicate grid instance is attempted to be created. Thus the ASP.NET AJAX framework fails to associate the second grid with the respective client instance through the $create method executed in the Sys.Application.add_init() handler. The odd part is that this happens only when the grid is in edit mode and you click the button which has to redisplay the form.

Can you please share with us your code implementation in this forum thread (posting the code from the problematic page using the 'Format Code Block' dialog from the top right corner of the forum editor)? We will examine it carefully and will do our best to assist you solve the problem.

Best regards,

Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
IQworks
Top achievements
Rank 1
answered on 28 May 2009, 08:36 PM
Ok, I am having problems with the code formater. Maybe its because the code is inline. So, I have to send it section by section.

this is the C# code .....

  protected void Page_Load(object sender, EventArgs e)  
    {  
        /*********************************************************/ 
        // include in all code where the user might use FireFox.  
        //if (Request.Browser.Browser == "Firefox")  
        //    Response.Cache.SetNoStore();  
        // All non IE Browsers  
        if (Request.Browser.MSDomVersion.Major == 0) // Non IE Browser?)  
            {  
            Response.Cache.SetNoStore(); // No client side cashing for non IE browsers  
            }    
        /*********************************************************/ 
 
        if (!IsPostBack)  
        {  
            if (Session["iqLoggedin"] != "Yes" && Session["iqLoggedin"] != "Join")  
               {  
                 //  Server.Transfer("/mybodyscience/V01/ab0_Default.aspx");  
               }  
             
            Session["ScreenMode"] = "Summary"// Medium or Full   
           // equipmentGrid.Width = 398;    
            // For Testing        
              Session["iqMemberNo"] = 2;  
              Session["mbsVersion"] = "V01";  
              
            // Initialize work  fields  
            Session["equErrors"] = "";  
            //&&  equipmentGrid.ClientSettings.Scrolling.AllowScroll = true;  
 
 
            //  HtmlGenericControl radgrid = (HtmlGenericControl)equipmentGrid.MasterTableView.FindControl("RadToolTip1");  
            //  radgrid.Attributes.Add("onload", "ShowTooltip();");  
        }  
 
        // initialize for appropriate mode  
      /*  if (Session["MSB_Functionality"] == "Medium")
        {
        equipmentGrid.Width = 398 ;  
        }
        else
            {
            equipmentGrid.Width = 700;  
            }  */ 
           
    }  
    
    // Quick Exercise Location add button  
    public void quickLocationAdd(object sender, EventArgs e)  
    {  
        Session["quickButton"] = "Location";  
    }  
 
    // Quick Exercise Type add button  
    public void quickTypeAdd(object sender, EventArgs e)  
    {  
        Session["quickButton"] = "Type";  
 
    }  
    // Create the datasource for equipmentGrid  
    public void equipmentGrid_NeedDataSource(object sender, EventArgs e)  
    {  
    ManualNeedDataSource();  
    }  
     public void ManualNeedDataSource()  
    {  
    iqDAL dal = new iqDAL();  
    string iqerror = "";  
    Session["AnyDataRead"] = "No";  
 
    /* interesting, I think using LINQ would not bring back a joined equLocationName
     * because you are not using a join statement in the LINQ's SQL statement. But, 
     * In using GetEquipmentInfo, you should see equlocationName because this 
     * SPROC does use the join. */ 
    string dasdf = Session["iqMemberNo"].ToString();  
    DataSet eqpDataSet = dal.GetEquipmentInfo((System.Convert.ToInt32(Session["iqMemberNo"].ToString())), out iqerror);  
 
    if (iqerror == ""// Member does have Equipment records    
        {  
        equipmentGrid.DataSource = eqpDataSet;  
        Session["AnyDataRead"] = "Yes";  
 
        /*  If you are using AutoGenerated links and you have data
        equipmentGrid.AutoGenerateDeleteColumn = true; 
        equipmentGrid.AutoGenerateEditColumn = true; */ 
        }  
    else // Member has no Equipment records yet  
        {  
        // Need to set up the Columns you will be using, especially to avoid   
        // the column dosnt exist error when you display the entry screen   
        // for a member that dosn't  have any equipment records yet.  
        DataSet ds = new DataSet();  
        ds.Tables.Add();  
        ds.Tables[0].Columns.Add("equEquipmentNo"typeof(String));  
        ds.Tables[0].Columns.Add("equEquipmentName"typeof(String));  
        ds.Tables[0].Columns.Add("equEquipmentLocNo"typeof(Int32));  
        ds.Tables[0].Columns.Add("equEquipmentTypeNo"typeof(Int32));  
        ds.Tables[0].Columns.Add("equLocationName"typeof(String));  
        ds.Tables[0].Columns.Add("equEquipmentMake"typeof(String));  
        ds.Tables[0].Columns.Add("equEquipmentModel"typeof(String));  
        ds.Tables[0].Columns.Add("equEquipmentGymID"typeof(String));  
        ds.Tables[0].Columns.Add("equTypeName"typeof(String));  
        ds.Tables[0].Columns.Add("equEquipmentNotes"typeof(String));  
        // REMEMBER, with the following NewRow, you would be adding an empty row.   
        // ^^ ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); // REMEMBER, YOU ARE CREATING AT LEAST ONE BLANK ROW  
        equipmentGrid.DataSource = ds.Tables[0];  
 
        /*  If you are using AutoGenerated links and you DONT have data
        equipmentGrid.AutoGenerateDeleteColumn = false; 
        equipmentGrid.AutoGenerateEditColumn = false; */ 
 
        }      
    }  
 
    /// <summary>  
    /// All commands come through here  
    /// </summary>  
    ///   
    protected void equipmentGrid_ItemCommand(object sender, GridCommandEventArgs e)  
    {  
        // If the quicklocationadd or quicktypeadd buttons pressed  
        // then cancel this equipmentGrid_ItemCommand  
        
          
        // Always start out with scrolling set to true.   
        // This will keep the height in the RadGrid when there  
        // are less than 10 items.   
        equipmentGrid.ClientSettings.Scrolling.AllowScroll = true;  
        Session["equErrors"] = "";  
        GridItem cItem = (GridItem)e.Item;  
        Session["iqCommandState"] = ""// Last command issued.    
        equipmentGrid.ShowHeader = true// Hidden in InitInsert  
 
 
        if (e.CommandName == "iqViewDetail")  
            {  
            Session["iqCommandState"] = "iqViewDetail";       
            Session["ScreenMode"] = "Detail";    
            // equipmentGrid.Width = 700;  
              
            // If user is in an Insertform, close it.  
            equipmentGrid.MasterTableView.IsItemInserted = false;  
              
            // If user is in editmode  
             equipmentGrid.MasterTableView.ClearEditItems(); // Cancels edit mode  
              
             equipmentGrid.Rebind();  
                    
             }  
          
        if (e.CommandName == "iqViewSummary")  
            {  
            Session["iqCommandState"] = "iqViewSummary";    
            Session["ScreenMode"] = "Summary";    
           // equipmentGrid.Width = 398;  
              
            // If user is in an Insertform, close it.  
            equipmentGrid.MasterTableView.IsItemInserted = false;  
              
            // If user is in editmode  
            equipmentGrid.MasterTableView.ClearEditItems(); // Cancels edit mode  
              
            equipmentGrid.Rebind();  
             
            }      
          
        if (e.CommandName == "InitInsert")  
        {  
            Session["iqCommandState"] = "AddNewRecordClicked"// Last command issued.   
            Session["equErrors"] = "  * Add data * ";  
 
            // Save the last page number, 0=First page.   
            Session["curPageIndex"] = e.Item.OwnerTableView.CurrentPageIndex;  
              
            // If an Editform is open, close it for this Requested Insertform  
            equipmentGrid.MasterTableView.ClearEditItems();  
 
            // hide header before displaying Insertform  
           equipmentGrid.ShowHeader = false//took out, causes insertform width issues  
 
            //&&  equipmentGrid.ClientSettings.Scrolling.AllowScroll = false;  
        }  
 
        if (e.CommandName == "iqRefresh")  
        {  
            //e.Item.IsInEditMode  
            Session["iqCommandState"] = "ScreenDataRefresh"// Last command issued.             
            Session["equErrors"] = "";  
 
            // If an Insertform is open for this   
            // Refresh request, then close the Insertform.  
            equipmentGrid.MasterTableView.IsItemInserted = false;  
            // End of closing Insertform.    
 
            // If an Editform is open, close it for this Requested Refresh  
            equipmentGrid.MasterTableView.ClearEditItems();  
 
            //&& equipmentGrid.ClientSettings.Scrolling.AllowScroll = false;  
            equipmentGrid.MasterTableView.CurrentPageIndex = 0;  
            equipmentGrid.MasterTableView.SortExpressions.Clear();  
            equipmentGrid.MasterTableView.GroupByExpressions.Clear();  
            /* Rebind here in refresh sets the griddata back to the 
             * beginning. But currently also resets the dropdowns when
             * the editform is displayed.
             */ 
            equipmentGrid.Rebind();  
        }  
 
        if (e.CommandName == "PerformInsert")  
        {  
            Session["iqCommandState"] = "AddData"// Last command issued.             
            Session["equErrors"] = "";  
 
        }  
 
 
        if (e.CommandName == "Edit"// EditForm for Update requested.  
        {  
            Session["iqCommandState"] = "EditData"// Last command issued.             
            Session["equErrors"] = "";  
 
            // Save the last page number, 0=First page.    
            Session["curPageIndex"] = e.Item.OwnerTableView.CurrentPageIndex;  
             
            // If an Insertform is open for this   
            // requested Editform, then close the Insertform.  
            equipmentGrid.MasterTableView.IsItemInserted = false;  
            equipmentGrid.Rebind();  
            // End of closing Insertform.    
              
            // Illiminate scroll bars when displaying editform. If  
            // commented out, scrollbars appear on editform.   
            // equipmentGrid.ClientSettings.Scrolling.AllowScroll = false;  
         }  
 
        if (e.CommandName == "Update"// Update pressed after edit.  
        {  
            Session["iqCommandState"] = "UpdateData"// Last command issued.             
            Session["equErrors"] = "";  
 
        }  
 
        if (e.CommandName == "Delete"// Delete pressed after edit.  
        {  
 
            Session["iqCommandState"] = "DeleteData"// Last command issued.             
            Session["equErrors"] = "";  
            GridDataItem gdi = (GridDataItem)e.Item;  
            GridItem gitm = (GridItem)e.Item;  
 
            int sMemberNo = Convert.ToInt32(Session["iqMemberNo"].ToString());  
            int wkEquipmentNo = Convert.ToInt32(gdi.GetDataKeyValue("equEquipmentNo"));  
 
            string deletedName = e.Item.OwnerTableView.Items[e.Item.ItemIndex]["equEquipmentName"].Text;  
             
                        
            // In case The editform was open, and the delete was called   
            // on this item.    
            equipmentGrid.MasterTableView.IsItemInserted = false;   
              
            Session["equErrors"] = " * Deletion successful";  
            iqDAL dal = new iqDAL();  
            dal.DeleteEquipmentInfo(sMemberNo, wkEquipmentNo);  
            equipmentGrid.Rebind();    
                     
            Session["equErrors"] = deletedName + " Equipment Successfully Deleted";  
        }  
 
        if (e.CommandName == "Page"// paging forward and back.  
        {  
            Session["iqCommandState"] = "PageForwardBack"// Last command issued.             
            Session["equErrors"] = "";  
        }  
 
        if (e.CommandName == "Cancel"// User canceled out of a form.  
            {  
            Session["iqCommandState"] = "Cancel"// Last command issued.             
            Session["equErrors"] = "";  
             
            // Get the last Grid page the user was on before   
            // this form was displayed. (0=First page).              
            e.Item.OwnerTableView.CurrentPageIndex = int.Parse(Session["curPageIndex"].ToString());  
             
            //e.Canceled = true; // cancels this cancel command for example !   
            //return;   
 
            }  
          
    }  
 
    /// <summary>  
    /// Add Equipment Data selected  
    /// </summary>  
    ///   
    protected void equipmentGrid_SaveData(object sender, GridCommandEventArgs e)  
    {// Is used by OnInsertCommand & OnUpdateCommand in equipmentGrid  
 
        int sMemberNo = Convert.ToInt32(Session["iqMemberNo"].ToString());  
 
        iqDAL dal = new iqDAL();  
 
        if ((e.CommandName == "PerformInsert") || (e.CommandName == "Update"))  
        {  
            DropDownList wklocDDL;  
            DropDownList wktypeDDL;  
            int wkEquipmentNo = 0;  
            string wkEquipmentName = "";  
            string wkEquipmentMake = "";  
            string wkEquipmentModel = "";  
            string wkEquipmentGymID = "";  
            string wkEquipmentNotes = "";  
            string wkstrL = "";  
            string wkstr = "";  
            DateTime wkDateCreated = DateTime.Now;  
            DateTime wkDateUpdated = DateTime.Now;  
 
            // Prepare for adding data with GridEditFormInsertItem                    
            if (Session["iqCommandState"].ToString() == "AddData")  
            {  
                GridEditFormInsertItem iItem = (GridEditFormInsertItem)e.Item;  
                wkEquipmentNo = dal.GetNextEquipmentNumber(sMemberNo, wkEquipmentNo);  
                wklocDDL = (DropDownList)iItem.FindControl("equEquipmentddl");  
                wkstrL = wklocDDL.SelectedValue; // Because wklocDDL is created here  
                wktypeDDL = (DropDownList)iItem.FindControl("equEquipmentTypeddl");  
                wkstr = wktypeDDL.SelectedValue;  
                if (wktypeDDL.SelectedValue == "No Types Available")  
                {  
                    wkstr = "";  
                }  
                else 
                {  
                    wkstr = wktypeDDL.SelectedValue;  
                }  
                wkEquipmentName = (iItem.FindControl("sEquipmentName"as TextBox).Text;  
                wkEquipmentMake = (iItem.FindControl("sequEquipmentMake"as TextBox).Text;  
                wkEquipmentModel = (iItem.FindControl("sequEquipmentModel"as TextBox).Text;  
                wkEquipmentGymID = (iItem.FindControl("sequEquipmentGymID"as TextBox).Text;  
                wkEquipmentNotes = (iItem.FindControl("sequEquipmentNotes"as TextBox).Text;  
            }  
 
            // Prepare for adding data with GridEditFormItem        
            if (Session["iqCommandState"].ToString() == "UpdateData")  
            {  
                GridEditFormItem iItem = (GridEditFormItem)e.Item;  
 
                // string eqno = (iItem.FindControl("equEquipmentNo") as TextBox).Text;  
                // wkEquipmentNo = Convert.ToInt32(eqno);   
                wkEquipmentNo = Convert.ToInt32(iItem.GetDataKeyValue("equEquipmentNo"));  
                // wkEquipmentNo = dal.GetNextEquipmentNumber(sMemberNo, wkEquipmentNo);  
                wklocDDL = (DropDownList)iItem.FindControl("equEquipmentddl");  
                wkstrL = wklocDDL.SelectedValue; // Because wklocDDL is created here  
                wktypeDDL = (DropDownList)iItem.FindControl("equEquipmentTypeddl");  
                if (wktypeDDL.SelectedValue == "No Types Available")  
                {  
                    wkstr = "";  
                }  
                else 
                {  
                    wkstr = wktypeDDL.SelectedValue;  
                }  
                wkEquipmentName = (iItem.FindControl("sEquipmentName"as TextBox).Text;  
                wkEquipmentMake = (iItem.FindControl("sequEquipmentMake"as TextBox).Text;  
                wkEquipmentModel = (iItem.FindControl("sequEquipmentModel"as TextBox).Text;  
                wkEquipmentGymID = (iItem.FindControl("sequEquipmentGymID"as TextBox).Text;  
                wkEquipmentNotes = (iItem.FindControl("sequEquipmentNotes"as TextBox).Text;  
 
            }  
 
            // Exercise Location  
            int wkEquipmentLocNo = 1;  
            if ((wkstrL != null) && (wkstrL != ""))  
                wkEquipmentLocNo = Convert.ToInt32(wkstrL);  
 
 
            // Exercise Type  
            int wkEquipmentTypeNo = 0;  
            string wkEquipmentType = "";  
            if ((wkstr != null) && (wkstr != ""))  
            {  
                string[] wkTypsplit = wkstr.Split(' ');  
                if (wkTypsplit[0] != "")  
                    wkEquipmentTypeNo = Convert.ToInt32(wkTypsplit[0]);  
                wkEquipmentType = wkTypsplit[1];  
            }  
 
            // Store the data    
            dal.StoreEquipmentInfo(  
           sMemberNo,  
           wkEquipmentNo,  
           wkEquipmentLocNo,  
          // wkEquipmentType,  
           wkEquipmentTypeNo,  
           wkEquipmentName,  
           wkEquipmentMake,  
           wkEquipmentModel,  
           wkEquipmentGymID,  
           wkEquipmentNotes,  
           wkDateCreated,  
           wkDateUpdated);  
 
            if (Session["iqCommandState"].ToString() == "AddData")  
                Session["equErrors"] = wkEquipmentName + " " + " Added Succesfully";  
 
            if (Session["iqCommandState"].ToString() == "UpdateData")  
                Session["equErrors"] = wkEquipmentName + " " + " Changed Succesfully";  
 
        }  
 
    }  
 
 
    /// <summary>  
    /// In ItemDataBound, the screen fields are already bound, so now, you can   
    /// change attributes, etc.   
    /// ItemDataBound is always called when you do a equipmentGrid.DataBind or Rebind.   
    /// </summary>      
    protected void equipmentGrid_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        string sa = e.Item.ToString();  
        int sMemberNo = Convert.ToInt32(Session["iqMemberNo"].ToString());  
        iqDAL dal = new iqDAL();  
 
 
        if (e.Item is GridDataItem)  
        {  
            GridDataItem dataItem = (GridDataItem)e.Item;  
            //string strtxt = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["clClientCode"].ToString();  
            // Header  
 
            // Manipulate GRID DATA NOT THE COLUMN ITSELF, JUST DATA IN THE COLUMN  
           /* dataItem["equEquipmentNo"].ToolTip = "Equipment Number";
            dataItem["equEquipmentName"].ToolTip = "Name of Equipment";           
            dataItem["equLocationName"].ToolTip = "Location of Equipment";
            dataItem["equEquipmentMake"].ToolTip = "Make of Equipment";
            dataItem["equTypeName"].ToolTip = "Type of Equipment.";
            dataItem["equEquipmentNotes"].ToolTip = "Notes about this piece of Equipment";
            dataItem["equEquipmentModel"].ToolTip = "Model of Equipment.";
            dataItem["equEquipmentGymID"].ToolTip = "ID of this Equipment at the facility";
            dataItem["DeleteColumn"].ToolTip = "Delete This Equipment";
            dataItem["iqEditColumn"].ToolTip = "Change This Equipment Data"; */ 
 
            // Functionality - dont worry, when you do the body composition,   
            // the summary detail screen will automatically get scrollbars, so,   
            // no need to allow column resizing.   
             GridColumn column;  
            if (Session["ScreenMode"] == "Summary")  
                {  
                // dataItem["equTypeName"].Visible = false; // works for the data only, not the heading.  
                column = equipmentGrid.MasterTableView.Columns.FindByUniqueName("equTypeName");  
                column.Visible = false;  
                column = equipmentGrid.MasterTableView.Columns.FindByUniqueName("equEquipmentModel");  
                column.Visible = false;  
                column = equipmentGrid.MasterTableView.Columns.FindByUniqueName("equEquipmentGymID");  
                column.Visible = false;  
                column = equipmentGrid.MasterTableView.Columns.FindByUniqueName("equEquipmentNotes");  
                column.Visible = false;  
                }  
            else 
                {  
                column = equipmentGrid.MasterTableView.Columns.FindByUniqueName("equTypeName");  
                column.Visible = true;  
                column = equipmentGrid.MasterTableView.Columns.FindByUniqueName("equEquipmentModel");  
                column.Visible = true;  
                column = equipmentGrid.MasterTableView.Columns.FindByUniqueName("equEquipmentGymID");  
                column.Visible = true;  
                column = equipmentGrid.MasterTableView.Columns.FindByUniqueName("equEquipmentNotes");  
                column.Visible = true;  
                }  
              
          /*   RadToolTip rtt = new RadToolTip();
             rtt.ID = "Rtt" + dataItem["equEquipmentNo"].Text;
             rtt.RelativeTo =   ToolTipRelativeDisplay.Element ;
             rtt.Skin = "Hay";
             rtt.TargetControlID = dataItem["equEquipmentNo"].ClientID;
             rtt.HideEvent = ToolTipHideEvent.ManualClose; */ 
             // End of dynamic tooltip */  
 
            // Create Delete Confirmation mechanism  
            GridDataItem Ldelete = e.Item as GridDataItem;  
 
              
            Label elName = (Label)e.Item.FindControl("lblequEquipmentName");  
            string eName = elName.Text;     
            ImageButton button = Ldelete["DeleteColumn"].Controls[0] as ImageButton;  
            //LinkButton button = (LinkButton)(e.Item.UniqueID["DeleteColumn"] as LinkButton);  
            button.Attributes["onclick"] = "return confirm('Are you sure you want to delete " +  
            eName + "?')";  
            button.ToolTip = "Delete this Equipment";  
            // End create delete confirmation mechanism  
        }  
 
 
 
        if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))  
        {  
 
            //*****************************************************************  
            // I N I T   D R O P D O W N S  T O   A D D   N E W   R E C O R D *   
            //*****************************************************************  
 
 
            // All of these conditions will load or refresh the DropDownLists   
            if ((Session["iqCommandState"] == "AddNewRecordClicked") ||  
                 (Session["iqCommandState"] == "ScreenDataRefresh") ||  
                  (Session["iqCommandState"] == "EditData") ||  
                 (Session["iqCommandState"] == "PageForwardBack")) // Last command issued.    
            {  
                //  GridEditFormInsertItem iItem = (GridEditFormInsertItem)e.Item;  
                GridEditFormItem editform = (GridEditFormItem)e.Item;  
 
 
                //*************************************************  
                // Load locations drop down  
                // Dont need to know location or type code on new entry screen, only   
                // when they are in edit (update) mode.     
                //*************************************************   
                string iqerror = "";  
                string SelValue = "";  
                DropDownList equEquipmentddl = (DropDownList)editform.FindControl("equEquipmentddl");  
 
                int slocNo = 1;  
                string slocNot = "";  
                if (Session["iqCommandState"] == "EditData")  
                {  
                    TextBox slocNob = (TextBox)editform.FindControl("sequEquipmentLocNo");  
                    slocNo = Convert.ToInt32(slocNob.Text); // For int use  
                    slocNot = slocNob.Text; // for string use  
                    Label ltitle = (Label)editform.FindControl("lblTitle");  
                    ltitle.Text = "Change Equipment Information";  
                }  
                DataSet IqLocDataSet = new DataSet();  
                   
                IqLocDataSet = dal.GetLocationInfo(sMemberNo, out iqerror);  
                if (iqerror == "")  
                {  
                    // Build Locations                      
                    equEquipmentddl.ClearSelection();  
                    equEquipmentddl.DataSource = IqLocDataSet;  
                    equEquipmentddl.DataMember = "Table";  
                    equEquipmentddl.DataTextField = "sloLocation";  
                    equEquipmentddl.DataValueField = "sloNumber";  
                    equEquipmentddl.SelectedValue = slocNot;  
                    equEquipmentddl.DataBind();  
                    // Remove the default text and value = "Select"  
                    equEquipmentddl.Items.Remove(equEquipmentddl.Items.FindByText("Select"));  
                }  
 
                //*************************************************  
                // End of Load locations    
                //*************************************************  
                //*************************************************  
                // Load Type drop down   
                // Dont need to know location or type code on new entry screen, only   
                // when they are in edit (update) mode.     
                //*************************************************  
                iqerror = "";  
                SelValue = "";  
                string wkValue = "";  
                DropDownList equEquipmentTypeddl = (DropDownList)editform.FindControl("equEquipmentTypeddl");  
                // exer.xmExerciseName = (iItem.FindControl("sExerciseName") as TextBox).Text;  
                // TextBox sequEquipmentTypeNo = (TextBox)editform.FindControl("sequEquipmentTypeNo");  
                int stypNo = 1;  
                string stypNot = "1";  
 
                if (Session["iqCommandState"] == "EditData")  
                {  
                    TextBox stypNob = (TextBox)editform.FindControl("sequEquipmentTypeNo");  
                    stypNo = Convert.ToInt32(stypNob.Text); // For int use    
                    stypNot = stypNob.Text; // for string use  
                }  
 
                DataSet IqTypeDataSet = new DataSet();  
                IqTypeDataSet = dal.GetTypesInfo(sMemberNo, "EquipmentType"out iqerror);  
                if (iqerror == "")  
                {  
                    DataRow dr = IqTypeDataSet.Tables[0].Rows[0];  
                    wkValue = dr["typTypeNo"].ToString() + " " + dr["typTypeCode"].ToString();  
                    if (Session["iqCommandState"] == "EditData")  
                    {  
                        wkValue = stypNot + " " + dr["typTypeCode"].ToString();  
                    }  
                    equEquipmentTypeddl.DataSource = IqTypeDataSet;  
                    equEquipmentTypeddl.DataMember = "Table";  
                    equEquipmentTypeddl.DataTextField = "typTypeName";  
                    equEquipmentTypeddl.DataValueField = "typTypeKey";  
                    equEquipmentTypeddl.SelectedValue = wkValue;  
                    equEquipmentTypeddl.DataBind();  
                    // Remove the default text and value = "Select"  
                    equEquipmentTypeddl.Items.Remove(equEquipmentTypeddl.Items.FindByText("Select"));  
                }  
                //*************************************************  
                // End of Load Types    
                //*************************************************  
                if (Session["iqCommandState"] == "AddNewRecordClicked")  
                {// Close the gap between last grid record and pager  
                    Label Ititle = (Label)editform.FindControl("lblTitle");  
                    Ititle.Text = "New Equipment Information";  
                    equipmentGrid.ClientSettings.Scrolling.AllowScroll = false;  
                }  
 
               // Session["iqCommandState"] = ""; // Last command issued.    
            }  
 
        } // End of (e.Item is GridEditFormItem) && (e.Item.IsInEditMode)  
 
        /*------------------------------------------------*/  
        //Start Name & Information ToolTiP data load  
        /*------------------------------------------------*/ 
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)  
        {  
            GridItem lItem = e.Item as GridItem;  
            /* equEquipmentNotes is 100 bytes.
             * ((DataRowView)e.Item.DataItem)["equEquipmentNotes"]
             * cannot be updated because it is a bound item (actual data)
             * (lItem.FindControl("enotes") as TextBox) can be 
             * updated because it is an <asp:TextBox 
             * */ 
         
              
            // Build tooltip Equipment name  
            (lItem.FindControl("eName"as TextBox).Text =  
                ((DataRowView)e.Item.DataItem)["equEquipmentName"].ToString();  
             
            // Build tooltip Location name  
            (lItem.FindControl("eLocation"as TextBox).Text =  
                ((DataRowView)e.Item.DataItem)["equLocationName"].ToString();  
           
            // Build tooltip Type name  
            (lItem.FindControl("eType"as TextBox).Text =  
                ((DataRowView)e.Item.DataItem)["equTypeName"].ToString();  
              
            // Build tooltip Make   
            (lItem.FindControl("eMake"as TextBox).Text =  
               ((DataRowView)e.Item.DataItem)["equEquipmentMake"].ToString();  
 
            // Build tooltip Model   
            (lItem.FindControl("eModel"as TextBox).Text =  
              ((DataRowView)e.Item.DataItem)["equEquipmentModel"].ToString();  
 
            // Build tooltip GymID  
            (lItem.FindControl("eGymID"as TextBox).Text =  
              ((DataRowView)e.Item.DataItem)["equEquipmentGymID"].ToString();  
 
            // Build tooltip notes   
            (lItem.FindControl("eNotes"as TextBox).Text =  
              ((DataRowView)e.Item.DataItem)["equEquipmentNotes"].ToString();  
        }  
        //ToolTiP end  
        }  
 
    /// <summary>  
    ///   
    /// </summary>  
    protected void equipmentGrid_ItemCreated(object sender, GridItemEventArgs e)  
    {  
        string icwhat = e.Item.ToString();  
        string wh = e.Item.ItemType.ToString();  
        if (e.Item is GridStatusBarItem)  
        {  
            // Dont need to have "Ready"    
            if ((Session["equErrors"] != "") && (Session["equErrors"] != null))  
            {  
 
                /* This is setup so that we can send regular informational
                 * messages (Label) as well as messages that are more than
                 * 100 characters long (TextBox.Multiline).
                 */ 
                if (Session["equErrors"].ToString().Length > 100)  
                {  
                    TextBox eqErrors = new TextBox();  
                    eqErrors.TextMode = TextBoxMode.MultiLine;  
                    eqErrors.Rows = 1;  
                    eqErrors.Width = 340;  
                    eqErrors.ReadOnly = true;  
                    eqErrors.Text = Session["equErrors"].ToString();  
                    eqErrors.ID = "eqErrors";  
                    eqErrors.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF4500");  
                    if (eqErrors.Text != "")  
                        eqErrors.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF4500");  
                    e.Item.Cells[0].Controls.Add(eqErrors);  
                }  
                else 
                {  
                    Label eqErrors = new Label();  
                    eqErrors.Text = Session["equErrors"].ToString();  
                    eqErrors.ID = "eqErrors";  
                    eqErrors.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF4500");  
                    if (eqErrors.Text != "")  
                        eqErrors.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF4500");  
                    e.Item.Cells[0].Controls.Add(eqErrors);  
                }  
 
                // Example of obtaining the statusbar object  
                //GridStatusBarItem gsb = (GridStatusBarItem)e.Item;  
 
            }  
            Session["equErrors"] = "";  
        }  
 
 
 
    }  
 
    protected void equipmentGrid_PreRender(object sender, EventArgs e)  
    {  
 
    /* If the page is going to have 10 items (Page size value)
       then even out the scroll height number of pixels to 
       get rid of the ugly blank space between the last row and 
       the pager line. Is has nothing to do with the number 10. 
       the suggestion on the internet was 24, but 20 worked for 
       this grid. Remember, scroll bars will appear if any of the 
      * 10 lines have a column that has more data than will fit on one line.
      * But, if all ten lines have all columns that have one line of data
      * then the grid will show without scroll bars 
     *   Works well when I dont use scrollbarHeight, 
         Am using scrollbarheight for now=230. */ 
        RadGrid grid = sender as RadGrid;  
        int gridItems = grid.MasterTableView.Items.Count;  
        if (gridItems > 9)    
            {             
           // grid.ClientSettings.Scrolling.ScrollHeight = Unit.Pixel(gridItems * 23);  
            }  
 
        // If edit mode was selected for an item, dont display  
        // the other items in the grid. Only show the selected item   
        // at the top of the grid.   
        if (Session["iqCommandState"] == "EditData")  
            {  
            if (equipmentGrid.EditItems.Count > 0)  
                {  
                equipmentGrid.ClientSettings.Scrolling.AllowScroll = false;  
                foreach (GridDataItem item in equipmentGrid.MasterTableView.Items)  
                    {  
                    if (item != equipmentGrid.EditItems[0]) // all but the selected one  
                        {  
                        item.Visible = false;  
                        }  
                    }  
                }  
              
 
            }  
        
                 
        /*  if no data to display - THIS MAKES THE WHOLE GRID INVISIBLE
        if (Session["AnyDataRead"] =="No")
            {
            equipmentGrid.Visible = false;
            } */ 
          
           //GridCommandItem iqcommandItem = e.Item as GridCommandItem;  
          GridItem iqcommandItem = equipmentGrid.MasterTableView.GetItems(GridItemType.CommandItem)[0];   
          
         // User wants to see the Detail level          
         if (Session["ScreenMode"] == "Summary")   
             {  
             iqcommandItem.FindControl("iqSummary").Visible=false;  
             iqcommandItem.FindControl("iqDetail").Visible = true;  
             equipmentGrid.Width = 398;    
             }  
          // User wants to see the Summary level  
         if (Session["ScreenMode"] == "Detail")  
             {  
             iqcommandItem.FindControl("iqSummary").Visible = true;  
             iqcommandItem.FindControl("iqDetail").Visible = false;  
             equipmentGrid.Width = 700;    
             }   
               
               
           // iq$f00001 - Fix to allow rowindicator column to be hidden and for the   
           // formtemplate width to display with proper width.   
          equipmentGrid.MasterTableView.GetColumn("RowIndicator").HeaderStyle.Width = Unit.Pixel(1);    
          equipmentGrid.MasterTableView.GetColumn("RowIndicator").ItemStyle.Font.Size = FontUnit.Point(1);   
   
       
        }  
 
    
0
IQworks
Top achievements
Rank 1
answered on 28 May 2009, 08:44 PM
Here is the output code ....

 <body> 
    
 
    <div> 
    </div> 
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager>    
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" Transparency="20">  
        <table style="width: 100%; height: 100%;">  
            <tr style="height: 100%">  
                <td align="center" valign="middle" style="width: 100%">  
                    <asp:Image ID="Image2" ImageUrl="~/mybodyscience/iqimages/Loading_Images/loading3.gif" 
                        BorderWidth="0px" Height="45px" Width="145px" AlternateText="Processing Data ...." 
                        runat="server"></asp:Image> 
                </td> 
            </tr> 
        </table> 
    </telerik:RadAjaxLoadingPanel> 
    <table style="width: 100%;">  
        <tr> 
            <td style="width: 33%;">  
            </td> 
            <td style="width: 33%; margin: 0px">  
                 <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"   
                LoadingPanelID="RadAjaxLoadingPanel" >    
                    <%-- <asp:Image ID="Image1" runat="server" ImageUrl=" /mybodyscience/iqimages/iqimage$/iStock_000003163184XSmall.jpg" 
                        Height="135px" Width="398px" />--%> 
                       
                    <telerik:RadGrid ID="equipmentGrid" runat="server" AllowPaging="True" AllowSorting="True" 
                        GridLines="none" AutoGenerateDeleteColumn="false" EnableHeaderContextMenu="false"   
                        AutoGenerateColumns="false" OnItemCommand="equipmentGrid_ItemCommand" OnInsertCommand="equipmentGrid_SaveData" 
                        OnNeedDataSource="equipmentGrid_NeedDataSource" OnUpdateCommand="equipmentGrid_SaveData" 
                        Skin="Office2007" OnItemDataBound="equipmentGrid_ItemDataBound" ShowStatusBar="true" 
                        PageSize="10" OnPreRender="equipmentGrid_PreRender" OnItemCreated="equipmentGrid_ItemCreated" 
                         CssClass="MasterTable_Default" > 
                        <PagerStyle CssClass="iqBodyCompositionColors" Position="Bottom" AlwaysVisible="true" 
                            VerticalAlign="Bottom" Mode="NextPrevAndNumeric" ForeColor="DarkBlue" /> 
                        <StatusBarSettings LoadingText="Loading ..." ReadyText="Ready ..." /> 
                        <ClientSettings> 
                            <Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="230" /> 
                        <Resizing AllowRowResize="true" EnableRealTimeResize="false" ResizeGridOnColumnResize="false" 
                    AllowColumnResize="true"></Resizing> 
                        </ClientSettings> 
                        <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" GridLines="None" 
                            HeaderStyle-Wrap="false" NoMasterRecordsText="No Equipment entered as yet" 
                             TableLayout="Fixed"   
                              RowIndicatorColumn-Display="false"                                                                                  
                             DataKeyNames="equEquipmentNo">  
                           
 
                            <ItemStyle Font-Size="Small" ForeColor="#4E026E" BackColor="#FFE140" /> 
                            <AlternatingItemStyle Font-Size="Small" BackColor="#FFE973" ForeColor="Black" /> 
                            <%-- --%> 
                            <CommandItemTemplate>                                                         
                              
                                    <asp:Image ID="Image1" runat="server" ImageUrl="/mybodyscience/iqimages/iqimage$/iStock_000003163184XSmall.jpg" 
                                        Height="135px" Width="100%" /> 
                                  
                                <div style="text-align: center; background-color: #996633; color: Blue; font-size: medium">  
                                    <asp:Label ID="capID" runat="server" BackColor="#996633" ForeColor="Yellow" Text="Add or Change Your Equipment Information" /> 
                                </div> 
                 <table width="100%" style="background-color: Yellow;"  > 
                                <tr> 
                   <td align="left"   style="width: 15%">  
                                 <asp:LinkButton  Font-Size="small" ID="iqDetail" runat="server" CommandName="iqViewDetail" 
                                     ToolTip="Work with all Equipment Data" CausesValidation="false">                                          
                                         <img style="border:0px" alt="" src="../iqimages/trImages/qsfExpandCollapse.gif"  title="Work with all Equipment Data"/>  
                                              Detail</asp:LinkButton>   
                                                
                     
                            <asp:LinkButton  Font-Size="small" ID="iqSummary" runat="server" CommandName="iqViewSummary" 
                                ToolTip="View Summary Data" CausesValidation="false">                                          
                                         <img style="border:0px" alt="" src="../iqimages/trImages/qsfExpand.gif"  title="Work with Summary Data"/>  
                    Summary</asp:LinkButton> 
                    </td> 
                      <td align="left" rowspan="2" style="width: 30%">  
                                    <asp:LinkButton  Font-Size="small" ID="sequipAdd" runat="server" CommandName="InitInsert" 
                                        Visible='<%# !equipmentGrid.MasterTableView.IsItemInserted %>' ToolTip="Add New Equipment">                                          
                   <img style="border:0px" alt="" src="../iqimages/trImages/AddRecord.gif" title="Add New Equipment"/>  
                    Add New Equipment</asp:LinkButton> 
                     <td align="left" style="width: 20%">  
                                    <%-- Refresh (sequipRefresh) needs CausesValidation="false" - If the Insert or   
                        Edit Form is being displayed and you click refresh with no data in the   
                        EquipmentName field In the Form, the RequiredFieldValidator   
                        will not allow the Refresh to work --%> 
                                    <asp:LinkButton ID="iqCommandHelp" Font-Size="small" runat="server" CommandName="iqRefresh" 
                                        CausesValidation="false" ToolTip="Start List At First Item">  
                       <img style="border:0px" alt="" src="../iqimages/trImages/Refresh.gif" title="Start List At First Item" /> 
                   Refresh List</asp:LinkButton> 
                   </td> 
                   <td align="right" rowspan="2" style="width: 5%">  
                       <asp:Label ID="sequipHelp"                           
                         Font-Size="small" runat="server">  
                       <img style="border:0px" alt="" src="../iqimages/trImages/Help.gif"   /> 
                                    </asp:Label> 
                                </div> 
                                <telerik:RadToolTip ID="RadToolTipGeneralHelp" runat="server" ManualClose="false" 
                                    TargetControlID="sequipHelp" RelativeTo="Element" MouseTrailing="false" Skin="Outlook" 
                                    Animation="None" Sticky="true" ShowCallout="false" AutoCloseDelay="3000" Width="200px" Height="500px" 
                                    Position="MiddleRight" > 
                                    <div> 
                                        <style="text-align: center">  
                                            <b>My Body Science - General Help</b> 
                                        </p> 
                                        <style="text-align: left">  
                                            <b>Add New Equipment</b> - Click here to add additional Equipment that you use for  
                                            Exercise.  
                                        </p> 
                                        <style="text-align: left">  
                                            <b>Refresh List</b> - Click here to view the list of Equipment from the beginning.  
                                        </p> 
                                          <style="text-align: left">  
                                           <img style="border: 0px" alt=""  src="../iqimages/trImages/qsfExpandCollapse.gif" /> 
                                            <b>Detail</b> - Click here to see all of the data for all equipment.  
                                        </p> 
                                         <style="text-align: left">  
                                           <img style="border: 0px" alt=""  src="../iqimages/trImages/qsfExpand.gif" /> 
                                            <b>Summary</b> - Click here to see a summary of data for all equipment.  
                                        </p> 
                                        <style="text-align: left">  
                                            <img style="border: 0px" alt="" src="../iqimages/iqimage$/Delete.gif" /> 
                                            - Click here to permanently Delete this piece of Equipment from your list.  
                                        </p> 
                                       <style="text-align: left">  
                                            <img style="border: 0px" alt="" src="../iqimages/iqimage$/Edit2.gif" /> 
                                            - Click here to change the information about this piece of Equipment.  
                                        </p> 
                                        <style="text-align: left">  
                                            <b>Name & Detail</b> - Position your mouse over the Name of the Equipment to see  
                                            its<br> 
                                            Detail Information.  
                                        </p> 
                                        <style="text-align: left">  
                                            <img style="border: 0px" alt="" src="../iqimages/iqimage$/Help.gif" /> 
                                            - This is the <b>HELP link</b>. Position your mouse here see the help topic.<br> 
                                            To close the help, move the mouse away and click.  
                                        </p> 
                                    </div> 
                                </telerik:RadToolTip> 
                                </td> 
                            </tr> 
                                </table> 
                               
                            </CommandItemTemplate> 
                            <Columns> 
                                <telerik:GridBoundColumn DataField="equMemberNo" HeaderText="MemberNo" ReadOnly="true" 
                                    UniqueName="equMemberNo" Visible="false" DataType="System.String">  
                                </telerik:GridBoundColumn> 
                                <telerik:GridTemplateColumn UniqueName="equEquipmentNo" HeaderText="No."   
                                HeaderStyle-Width="20px" HeaderStyle-CssClass="rgHeader NoBorder"   
                                ItemStyle-CssClass="NoBorder"   
                                 Resizable="true" > 
                                    <ItemTemplate> 
                                        <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">  
                                            <asp:Label  ID="lblequEquipmentNo"   
                                            tooltip="The ID for this Equipment" 
                                            runat="server" Text='<%#Eval("equEquipmentNo")%>'></asp:Label> 
                                        </div> 
                                    </ItemTemplate> 
                                  </telerik:GridTemplateColumn>     
                                <%-- TTP Start--%> 
                               <telerik:GridTemplateColumn UniqueName="equEquipmentName" HeaderText="Name & Detail" Resizable="true">  
                                    <ItemTemplate> 
                                        <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">  
                                            <asp:Label Font-Underline="true" ID="lblequEquipmentName" 
                                            runat="server" Text='<%#Eval("equEquipmentName")%>'></asp:Label> 
                                        </div> 
                                        <telerik:RadToolTip ID="RadToolTip1" runat="server" ManualClose="false" TargetControlID="lblequEquipmentName" 
                                            RelativeTo="Mouse" Skin="Outlook" Animation="None" Sticky="true" AutoCloseDelay="3000" 
                                            Position="MiddleRight" ToolTip="Name of this Eqip"   
                                            Height="265" Width="325" > 
                                            <div style="background-color: Yellow; font-size: medium; color: Blue; font-weight: bolder">  
                                                <asp:Label runat="server" Style="background-color: Yellow" ID="Label7" Text="Equipment Information"</asp:Label> 
                                                <br> 
                                                <asp:Label runat="server" Style="background-color: Yellow" ID="Label6" Text="Name ..:"</asp:Label> 
                                                <asp:TextBox ID="eName" runat="server" TextMode="MultiLine" Width="200px" Rows="1" 
                                                    Wrap="true" ReadOnly="true" /> 
                                                <%--  Equipment .:    
                           <%# DataBinder.Eval(Container, "DataItem.equEquipmentName")%>--%> 
                                                <br> 
                                                <asp:Label runat="server" Style="background-color: Yellow" ID="Label9" Text="Locat ..:"</asp:Label> 
                                                <asp:TextBox ID="eLocation" runat="server" Width="200px" ReadOnly="true" /> 
                                                <%--  Equipment .:    
                           <%# DataBinder.Eval(Container, "DataItem.equLocationName")%>--%> 
                                                <br> 
                                                <asp:Label runat="server" Style="background-color: Yellow" ID="Label10" Text="Type ...:"</asp:Label> 
                                                <asp:TextBox ID="eType" runat="server" Width="200px" ReadOnly="true" /> 
                                                <%--  Equipment .:    
                           <%# DataBinder.Eval(Container, "DataItem.equTypeName")%>--%> 
                                                <br> 
                                                <asp:Label runat="server" Style="background-color: Yellow; overflow: hidden; text-overflow: ellipsis;  
                                                    white-space: nowrap;" ID="labell" Text="Make ...:"</asp:Label> 
                                                <asp:TextBox ID="eMake" runat="server" Width="200px" ReadOnly="true" /> 
                                                <%--  Make ......:   
                           <%# DataBinder.Eval(Container, "DataItem.equEquipmentMake")%>--%> 
                                                <br> 
                                                <asp:Label runat="server" Style="background-color: Yellow" ID="lbla" Text="Model .:"</asp:Label> 
                                                <asp:TextBox ID="eModel" runat="server" Width="200px" ReadOnly="true" /> 
                                                <%-- Model .....:  
                            <%# DataBinder.Eval(Container, "DataItem.equEquipmentModel")%>--%> 
                                                <br> 
                                                <asp:Label runat="server" Style="background-color: Yellow" ID="Label8" Text="GymID :"</asp:Label> 
                                                <asp:TextBox ID="eGymID" runat="server" Width="200px" ReadOnly="true" /> 
                                                <%-- Gym id ....:  
                            <%# DataBinder.Eval(Container, "DataItem.equEquipmentGymID")%>--%> 
                                                <div> 
                                                    <asp:Label runat="server" Style="background-color: Yellow" ID="lblNotes" Text="Notes ..:"</asp:Label> 
                                                    <asp:TextBox ID="enotes" runat="server" TextMode="MultiLine" Width="200px" Rows="3" 
                                                        ReadOnly="true" /> 
                                                </div> 
                                                <%-- <%# DataBinder.Eval(Container, "DataItem.equEquipmentNotes")%> --%> 
                                                Created ...:  
                                                <%# DataBinder.Eval(Container, "DataItem.equDateCreated")%> 
                                                <br> 
                                                Changed .:  
                                                <%# DataBinder.Eval(Container, "DataItem.equDateCreated")%> 
                                            </div> 
                                        </telerik:RadToolTip> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <%-- TTP End--%> 
                                 
                                  
                                <telerik:GridTemplateColumn  UniqueName="equLocationName" HeaderText="Location" HeaderStyle-Width="92px" Resizable="true">  
                                    <ItemTemplate> 
                                        <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">  
                                            <asp:Label  ID="lblequLocationName" runat="server" 
                                             ToolTip="The Location of this Equipment" 
                                             Text='<%#Eval("equLocationName")%>'></asp:Label> 
                                        </div> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                          <%-- <telerik:GridBoundColumn DataField="equTypeName" HeaderText="TypeName" 
                            HeaderStyle-Width="92px" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" 
                           UniqueName="equTypeName" MaxLength=50 
                                ReadOnly="true">   
                            </telerik:GridBoundColumn> --%> 
                             <telerik:GridTemplateColumn UniqueName="equTypeName"  HeaderText="Type" HeaderStyle-Width="92px" Resizable="true">  
                                    <ItemTemplate> 
                                        <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">  
                                            <asp:Label  ID="lblequTypeName" runat="server" 
                                             ToolTip="The Type of this Equipment" 
                                             Text='<%#Eval("equTypeName")%>'></asp:Label> 
                                        </div> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn>   
                                 
                                <telerik:GridTemplateColumn UniqueName="equEquipmentMake"  HeaderText="Make" HeaderStyle-Width="92px" Resizable="true">  
                                    <ItemTemplate> 
                                        <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">  
                                            <asp:Label  ID="lblequEquipmentMake" runat="server" 
                                             ToolTip="The Make of this Equipment" 
                                             Text='<%#Eval("equEquipmentMake")%>'></asp:Label> 
                                        </div> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                 <telerik:GridTemplateColumn UniqueName="equEquipmentModel"  HeaderText="Model" HeaderStyle-Width="60px" Resizable="true">  
                                    <ItemTemplate> 
                                        <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">  
                                            <asp:Label  ID="lblequEquipmentModel" runat="server" 
                                             ToolTip="The Model of this Equipment" 
                                             Text='<%#Eval("equEquipmentModel")%>'></asp:Label> 
                                        </div> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn UniqueName="equEquipmentGymID"  HeaderText="GymID" HeaderStyle-Width="60px" Resizable="true">  
                                    <ItemTemplate> 
                                        <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">  
                                            <asp:Label  ID="lblequEquipmentGymID" runat="server" 
                                             ToolTip="This Facilities ID for this Equipment" 
                                             Text='<%#Eval("equEquipmentGymID")%>'></asp:Label> 
                                        </div> 
                                    </ItemTemplate> 
                                    </telerik:GridTemplateColumn>   
                                <telerik:GridTemplateColumn UniqueName="equEquipmentNotes"  HeaderText="Notes" HeaderStyle-Width="60px" Resizable="true">  
                                    <ItemTemplate> 
                                        <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">  
                                            <asp:Label  ID="lblequEquipmentNotes" runat="server" 
                                             ToolTip="Notes about this Equipment" 
                                             Text='<%#Eval("equEquipmentNotes")%>'></asp:Label> 
                                        </div> 
                                    </ItemTemplate> 
                                  </telerik:GridTemplateColumn>                                    
                                <telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" ImageUrl="../../iqimages/iqimage$/Delete.gif" 
                                    HeaderStyle-Width="20px" Resizable="false" 
                                     UniqueName="DeleteColumn" ItemStyle-HorizontalAlign="Center">  
                                    <ItemStyle HorizontalAlign="Center"/>  
                                </telerik:GridButtonColumn> 
                                  
                                <telerik:GridEditCommandColumn HeaderStyle-Width="20px" ButtonType="ImageButton" 
                                    UniqueName="iqEditColumn"                                        
                                     Resizable="false" EditImageUrl="../../iqimages/iqimage$/Edit2.gif">  
                                </telerik:GridEditCommandColumn> 
                            </Columns> 
                            <EditFormSettings EditFormType="Template">  
                                <FormStyle BackColor="#996633" ForeColor="Yellow" /> 
                                <FormTemplate> 
                                    <%--  <table id="Table2" cellspacing="0" cellpadding="0" width="100%" border="0"     
                                        style="border-collapse: collapse; background: white; font-size: small"> --%> 
                                    <div style="left: 5px">  
                                        <!-- Outer div --> 
                                        <div style="text-align: center; font-size: medium; width: 100%">  
                                            <asp:Label ID="lblTitle" runat="server" Width="358px" Font-Bold="true" /> 
                                            <asp:Label ID="seFormHelp" Width="10" Font-Size="medium" ForeColor="Yellow" Font-Bold="true" 
                                                runat="server">  
                                           <img style="border:0px; " alt="Help" src="../iqimages/trImages/Help.gif"   /> 
                                            </asp:Label> 
                                            <telerik:RadToolTip ID="RadToolTipFormHelp" runat="server" ManualClose="true" TargetControlID="seFormHelp" 
                                                Position="MiddleRight" RelativeTo="Element" Skin="Outlook" Animation="None" Sticky="true" 
                                                 Width="250" Height="600" 
                                                 AutoCloseDelay="3000">  
                                                <div> 
                                                    <style="text-align: center">  
                                                        <b>Maintain Equipment Information </b> 
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <b>Name </b>- Give this Equipment a Name. An Example could be "Row Machine".<br> 
                                                        You may use different Row Machines. So, the first one could be Row Machine 1.  
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <b>Location </b>- From your Exercise Location list, choose the location where   
                                                        this equipment is.<br> If you have not entered any of your Exercise Locations   
                                                        , you can go to the Exercise Location page and enter your Exercise Locations.  
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <b>Type </b>- From your Type list, choose the Type of Exercise Equipemnt this is.<br> 
                                                        If you have not entered any of your Types, you can go to the Type Maintenance  
                                                        page and enter your Types.<br> Some Examples of Types could be "Cardio Equipment"  
                                                           
                                                        , "Hiking Equipment" or "Exercise Clothing".  
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <b>Make and Model </b>- You can enter the Make and Manufacturer Model if you  
                                                           
                                                        like.  
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <b>Gym ID </b>- In some gyms and fitness centers, they put information to identify   
                                                        that piece of equipment. Most of the time it will be a number.<br> You can put that  
                                                           
                                                        information here.<br> It helps when a facility has more than one of the same piece of  
                                                        Equipment.<br> 
                                                        Even though Equipment may be the same, sometimes they may be calibrated differently,  
                                                           
                                                        or, one may work better than another for you.<br>   
                                                        It also helps if you need to remember which Equipment you use in a facility.  
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <b>Notes</b>- Note any information that is important to you about this Equipment<br> 
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <b>Save </b>- Click this to Save your Information.<br> 
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <b>Cancel</b>- Cancel your current request to Add or Update Equipment information.<br> 
                                                    </p> 
                                                    <style="text-align: left">  
                                                        <img style="border: 0px" alt="" src="../iqimages/trImages/Help.gif" /> 
                                                        - This is the <b>HELP link</b>. Position your mouse here see the help topic.<br> 
                                                        To close the help, move the mouse away and click.  
                                                    </p> 
                                                </div> 
                                            </telerik:RadToolTip> 
                                        </div> 
                                        <div> 
                                            <asp:TextBox ID="TextBox1" Width="0px" runat="server" Text='<%# Bind( "equEquipmentNo") %>' 
                                                Visible="false" /> 
                                        </div> 
                                        <br> 
                                        <div style="margin-left: 5px; font-size: medium">  
                                            <asp:Label ID="Label1" runat="server" Text="Name .....:" ToolTip="Equipment Name " 
                                                Width="85px" Font-Bold="true" /> 
                                            <asp:TextBox ID="sEquipmentName" Width="250px" MaxLength="50" runat="server" Text='<%# Bind( "equEquipmentName") %>' /> 
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="sEquipmentName" 
                                                Text="!" ErrorMessage="You Need Equipment Name" runat="server">  
                                            </asp:RequiredFieldValidator> 
                                        </div> 
                                        <br> 
                                        <div style="margin-left: 5px; font-size: medium">  
                                            <asp:TextBox ID="sequEquipmentLocNo" Width="0px" runat="server" Text='<%# Bind( "equEquipmentLocNo") %>' 
                                                Visible="false" Font-Bold="true" /> 
                                            <asp:Label ID="Labeltyp1" runat="server" Text="Location .:" ToolTip="Select Equipment Location " 
                                                Width="85px" Font-Bold="true" /> 
                                            <asp:DropDownList ID="equEquipmentddl" Width="150px" runat="server" AppendDataBoundItems="True">  
                                                <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem> 
                                            </asp:DropDownList> 
                                            <%--ImageButton in a form only postback on OnClick= --%> 
                                            <asp:ImageButton runat="server" ID="quickAddLocation" ImageUrl="~/mybodyscience/iqimages/led-icons/add.png" 
                                             OnClick="quickLocationAdd" CommandName="quickLocationAdd" CausesValidation="false" ToolTip="Add/Change Exercise Location" /> 
                                            
                                          </div> 
                                        <br> 
                                        <div style="margin-left: 5px; font-size: medium">  
                                            <asp:TextBox ID="sequEquipmentTypeNo" Width="0px" runat="server" Text='<%# Bind( "equEquipmentTypeNo") %>' 
                                                Visible="false" /> 
                                            <asp:Label ID="Label2" runat="server" Text="Type ......:" ToolTip="Select Equipment Type " 
                                                Width="85px" Font-Bold="true" /> 
                                            <asp:DropDownList ID="equEquipmentTypeddl" Width="150px" runat="server" AppendDataBoundItems="True">  
                                                <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem> 
                                            </asp:DropDownList> 
                                           <%--ImageButton in a form only postback on OnClick= --%> 
                                            <asp:ImageButton runat="server" ID="quickAddEquipmentType"  ImageUrl="~/mybodyscience/iqimages/led-icons/add.png" 
                                           OnClick="quickTypeAdd" CommandName="quickEquipTypeAdd" CausesValidation="False" ToolTip="Add/Change Equipment Type" /> 
                                        </div> 
                                        <br> 
                                        <div style="margin-left: 5px; font-size: medium">  
                                            <asp:Label ID="Label3" runat="server" Text="Make ......:" ToolTip="Equipment Make " 
                                                Width="85px" Font-Bold="true" /> 
                                            <asp:TextBox ID="sequEquipmentMake" Width="250px" MaxLength="30" runat="server" Text='<%# Bind( "equEquipmentMake") %>' /> 
                                        </div> 
                                        <br> 
                                        <div style="margin-left: 5px; font-size: medium">  
                                            <asp:Label ID="Label4" runat="server" Text="Model .....:" ToolTip="Equipment Model " 
                                                Width="85px" Font-Bold="true" /> 
                                            <asp:TextBox ID="sequEquipmentModel" Width="250px" MaxLength="30" runat="server" 
                                                Text='<%# Bind( "equEquipmentModel") %>' /> 
                                        </div> 
                                        <br> 
                                        <div style="margin-left: 5px; font-size: medium">  
                                            <asp:Label ID="Labgid" runat="server" Text="GymID ...:" ToolTip="Sometimes in a Gym, they label the equipment with a number or other ID" 
                                                Width="85px" Font-Bold="true" /> 
                                            <asp:TextBox ID="sequEquipmentGymID" Width="250px" MaxLength="15" runat="server" 
                                                Text='<%# Bind( "equEquipmentGymID") %>' /> 
                                        </div> 
                                        <br> 
                                        <div style="margin-left: 5px; font-size: medium">  
                                            <asp:Label ID="Label5" runat="server" Text="Notes .....:" ToolTip="Any notes or comments about this Piece of Equipment" 
                                                Width="85px" Font-Bold="true" /> 
                                            <asp:TextBox TextMode="MultiLine" ID="sequEquipmentNotes" Width="250px" MaxLength="100" 
                                                runat="server" Text='<%# Bind( "equEquipmentNotes") %>' /> 
                                        </div> 
                                        <br> 
                                        <div style="text-align: center">  
                                            <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Save" : "Save" %>' 
                                                runat="server" OnClientClick="ShowTooltip()" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>  
                                            </asp:Button>&nbsp;  
                                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" 
                                                CommandName="Cancel" OnClientClick="HideTooltip()"></asp:Button> 
                                        </div> 
                                    </div> 
                                    <!-- Outer div --> 
                                    <%--  </table> --%> 
                                </FormTemplate> 
                            </EditFormSettings> 
                        </MasterTableView> 
                    </telerik:RadGrid> 
                  </telerik:RadAjaxPanel>    
             
            </td> 
            <td style="width: 33%">  
                &nbsp;  
            </td> 
        </tr> 
    </table> 
    <telerik:RadToolTip runat="server" ID="RadToolTip1" Position="Center" HideEvent="ManualClose" 
        Skin="WebBlue" ShowEvent="FromCode" IsClientID="true" Width="300px" OnClientBeforeShow="CheckIfShow" 
        TargetControlID="btnUpdate">  
        <asp:ValidationSummary ID="ValidationSummary1" runat="server" /> 
    </telerik:RadToolTip> 
</body> 
   
</html> 
 
0
IQworks
Top achievements
Rank 1
answered on 28 May 2009, 08:47 PM

The javascript ....

 <script type="text/javascript">  
//<![CDATA[  
 
function HideTooltip()  
{   
var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();  
if (tooltip) tooltip.hide();  
}  
 
function ShowTooltip()  
{  
window.setTimeout(function()  
{  
    var tooltip = $find("equipment_Maint_RadToolTip1"); // Inside Masterpage only  
//var tooltip = $find("ctl00_mbfPlaceHolder1_equipment_Maint_RadToolTip1"); // in a page inside MasterPage  
 //API: show the tooltip  
 
tooltip.show();   
}, 10);  
}  
 
function CheckIfShow(sender, args)  
{  
//var summaryElem = document.getElementById("ctl00_mbfPlaceHolder1_ValidationSummary1");  
var summaryElem = document.getElementById("xequipment_Maint_ValidationSummary1");   
//check if summary is visible  
if (summaryElem.style.display == "none")  
{  
//API: if there are no errors, do not show the tooltip  
args.set_cancel(true);  
   
}  
}  
 
// General help tooltip JS  
function ShowTooltipGH()  
{  
window.setTimeout(function()  
{   
   
var tooltip = $find("equipment_Maint_equipmentGrid_ctl00_ctl02_ctl00_RadToolTipGeneralHelp"); // in a page inside MasterPage  
 //API: show the tooltip  
 
tooltip.show();   
}, 10);  
}  
 
// Form help tooltip JS  
function ShowTooltipFH()  
{  
window.setTimeout(function()  
{  
                        
var tooltip = $find("equipment_Maint_equipmentGrid_ctl00_ctl02_ctl00_RadToolTipGeneralHelp"); // in a page inside MasterPage  
 //API: show the tooltip  
 
tooltip.show();   
}, 10);  
}  
 
// Add a quick Exercise location    
function quickLocationAdd()  
{  
    alert("In QuickLocationAdd");  
}  
 
// Add a quick Equipment Type  
function quickEquipTypeAdd() {  
    alert("In QuickTypeAdd");  
}  
</script>  
 

The css ......

<style type="text/css">   
 
         .rgResizeCol  
           {        
          padding-left:0 !important;        
          padding-right:0 !important;    
           }   
   
        .rgResizeCol, .NoBorder  
          {   
          border-left:0 !important;     
          border-right:0 !important;    
          }     
    </style>  
0
IQworks
Top achievements
Rank 1
answered on 29 May 2009, 12:03 AM
Additional info - 

1)  I came from 2008 3.1125.35 version and installed licesnced version 2009 1.402.35 a few days before this.

2) I had posted this issue a few days ago, but they found an answer
http://www.telerik.com/community/forums/aspnet-ajax/grid/in-ie7-using-rowindicatorcolumn-display-quot-false-quot-causes-grid-width-issue.aspx

3) ****** PLEASE NOTE *******
while debugging, when the plus sign is pressed in edit mode, the 
 

 e.Item.IsInEditMode is "false" inside of ItemCommand() ? But, of course presseing the save button in debug shows isinEditMode as "true" in the ItemCommand() method. 
BUT -- IN insert mode (Add New Equipment) when you press the plus sign, the isinEditMode is "true" in the itemCommand() method.

thanks again

 

 

 

 

0
Sebastian
Telerik team
answered on 01 Jun 2009, 11:03 AM
Hello IQworks,

Unfortunately from the code snippets you provided I am not able to determine the exact cause of the erroneous behavior in this case. To advance in our investigation, I suggest you isolate a simple working subset of your project, illustrating the problem, and send it enclosed to a regular support ticket. I will test/debug it locally and will get back to you with my findings.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
IQworks
Top achievements
Rank 1
answered on 02 Jun 2009, 08:46 PM
Yea, ok, this may take me a day or so. I guess you need me to pull out as much code that has nothing to do with the erroneous funtionality as possible so you can just focus on where the problem is ?
In the mean time, can you tell me what could cause ....... 

3) ****** PLEASE NOTE *******
while debugging, when the plus sign is pressed in edit mode, the 
 

 e.Item.IsInEditMode is "false" inside of ItemCommand() ? But, of course presseing the save button in debug shows isinEditMode as "true" in the ItemCommand() method. 
BUT -- IN insert mode (Add New Equipment) when you press the plus sign, the isinEditMode is "true" in the itemCommand() method.

will get back to you in a support ticket when I pull as much code out of the program as I can and keep the program working.

thanks .....

0
Sebastian
Telerik team
answered on 03 Jun 2009, 03:34 PM
Hello IQworks,

If you do not mind, we will continue the communication in the support ticket you opened with regards to this subject to avoid duplicate posts and keep track of your support history easily.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
IQworks
Top achievements
Rank 1
Answers by
IQworks
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or