Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
177 views
Hello,
I'm using C# with VS 2010 Ultimate
The RadMenu OnItemClick event does not fire on the sub menu items. (it does fire on the main/top menu.
How can I get the sub menu's to trigger/fire the OnItemClick Event as well?

aspx code for menu:
<telerik:RadMenu ID="RadMenu1" runat="server" OnItemClick="RadMenu1_ItemClick"></telerik:RadMenu>

C# code:
    private void BuildMenu_CreateDocuments()
    {
        RadMenu1.Items.Add(new RadMenuItem("Logout"));
        RadMenu1.Items.Add(new RadMenuItem("Setting"));
        RadMenu1.Items.Add(new RadMenuItem("Document"));

        List<Model.Common.PartnerDocument> lstPartnerDocuments = new BL.PartnerDocumentBL().GetPartnerDocuments(m_intCustomerID, m_intPartnerID, m_bAdmin);

        if (lstPartnerDocuments.Count > 0)
        {
            for (int i = 0; i < lstPartnerDocuments.Count; i++)
            {
                RadMenu1.Items[ID_MENU_DOCUMENT].Items.Add(new RadMenuItem("Create " + lstPartnerDocuments[i].DocumentName, lstPartnerDocuments[i].PageUrl));
            }
        }
    }


Plamen
Telerik team
 answered on 02 Dec 2014
3 answers
71 views
Hi,

I am looking for a control which allows to display/preview and play files for all formate (Images, PDFs, MS Word, Video, Flash).

Thanks,
Nitin
Vessy
Telerik team
 answered on 02 Dec 2014
1 answer
96 views
Hi,

I've see an issue in my grid since I've made the last update with the telerik control panel. I don't know if it is due to the update or a change in my code. 
I have this grid :

<telerik:RadGrid ID="TrainingPlanRadGrid" runat="server" Width="100%"
   AutoGenerateColumns="false" AllowPaging="true" PageSize="13"
   ShowHeader="true" ShowFooter="false" ShowGroupPanel="false"
   ShowStatusBar="false"             
   OnNeedDataSource="TrainingPlanRadGrid_NeedDataSource"  
   OnItemDataBound="TrainingPlanRadGrid_ItemDataBound"
   AllowMultiRowSelection="true" AllowAutomaticInserts="false"
   AllowAutomaticDeletes="false"
   AllowAutomaticUpdates="false" AllowSorting="true"
   AllowFilteringByColumn="false"
   BorderStyle="None" Style="overflow: auto;"
   HeaderStyle-Font-Bold="true">
      <MasterTableView TableLayout="Fixed" Width="100%" ClientDataKeyNames="ID">
         <Columns>
            <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" Display="true">
               <ItemTemplate>
                  <asp:CheckBox ID="CheckBox1" runat="server"
                     OnCheckedChanged="ToggleRowSelection"
                     AutoPostBack="True" />
               </ItemTemplate>
               <HeaderTemplate>
                  <asp:CheckBox ID="headerChkbox" runat="server" 
                     OnCheckedChanged="ToggleSelectedStatePage" AutoPostBack="True" />
               </HeaderTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn UniqueName="RequestId" HeaderText=""
               DataField="ID" Visible="false" />
            <telerik:GridDateTimeColumn UniqueName="RequestDate" HeaderText="RequestDate"
               DataField="REQUEST_DATE" HeaderStyle-Wrap="false" HeaderStyle-Width="12%"
               HeaderStyle-HorizontalAlign="Right" ItemStyle-Width="12%"
               ItemStyle-HorizontalAlign="Right" />
            <telerik:GridBoundColumn UniqueName="RequestUser" DataField="USER_NAME"
               HeaderText="RequestUser" HeaderStyle-Wrap="false" HeaderStyle-Width="15%"
               ItemStyle-Width="15%" />
            <telerik:GridBoundColumn UniqueName="RequestUserOrg" DataField="ORG_LABEL"
               HeaderText="RequestUserOrg" HeaderStyle-Wrap="false" HeaderStyle-Width="15%"
               ItemStyle-Width="15%" />
            <telerik:GridBoundColumn UniqueName="RequestAdmin" DataField="ADMIN_NAME"
               HeaderText="RequestAdmin" HeaderStyle-Wrap="false" HeaderStyle-Width="15%"
               ItemStyle-Width="15%" />
            <telerik:GridBoundColumn UniqueName="RequestCourse" DataField="COURSE_NAME"
               HeaderText="RequestCourse" HeaderStyle-Wrap="false" HeaderStyle-Width="25%"
               ItemStyle-Width="25%" />
            <telerik:GridTemplateColumn UniqueName="RequestStatus" HeaderText="RequestStatus"
               HeaderStyle-Wrap="false" HeaderStyle-Width="12%" ItemStyle-Width="12%"
               ItemStyle-Wrap="false">
               <ItemTemplate>
                  <%# GetRequestStatus(Eval("REQUEST_STATUS").ToString())%>
               </ItemTemplate>
            </telerik:GridTemplateColumn>
         </Columns>
         <PagerStyle AlwaysVisible="false" Mode="NumericPages" />
      </MasterTableView>
      <HeaderStyle Font-Bold="true" />
      <ClientSettings Selecting-AllowRowSelect="true">
         <ClientEvents OnRowDblClick="editTrainingPlan"  />
      </ClientSettings>
</telerik:RadGrid>


This is the function selecting programmatically the row (on checkbox click) :

protected void ToggleRowSelection(object sender, EventArgs e)
        {
            GridItem item = ((sender as CheckBox).NamingContainer as GridItem);
            item.Selected = (sender as CheckBox).Checked;
            ...
        }

There is no exception thrown during the C# method.
But now, when I call this in js :

var grid = $find("TrainingPlanRadGrid");
var gridSelectedItems = grid.get_selectedItems();

I get an array with one "null" entry for each item I have selected in my C# code. And if I select a row by clicking on I get an entry containing a [Telerik.Web.UI.GridDataItem].

I can't use the auto-generated select checkbox column because I have extra features to add but I need to access in js and in C# to selected columns.

Do you see where I am doing something wrong ?
Eyup
Telerik team
 answered on 02 Dec 2014
2 answers
104 views
Hi,
I have a master page that contains a radSkinManager (that display a skin chooser). All child pages that contain rad controls seem to inherit the skins just fine but the background of my page style with default style - I assume that all controls must be inside some rad container to get styled properly?
Al
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 02 Dec 2014
2 answers
72 views
The problem which i am facing is that i have an ExportToExcel image button in the grid.When i click on that , it is not asking for 'Open' or 'Save'  file in Excel. Instead the datas which are to be in the Excel is displayed in UI grid itself. The excel button is in the "GridFilteringItem" . Please note that the grid is placed within RadAjaxPanel.The code which I have used is

public void grid _ItemCreated(object sender, GridItemEventArgs e)
{
//if (e.Item is GridCommandItem)
//{
// Button btncmd = (e.Item as GridCommandItem).FindControl("ExportToExcelButton") as Button;
// (this.Master.FindControl("ScriptManagerMain") as System.Web.UI.ScriptManager).RegisterPostBackControl(btncmd);
//}
if (e.Item is GridHeaderItem)
{
GridHeaderItem headerItem = (GridHeaderItem)e.Item; // access the header row
Button btnUpdate = new Button(); // creating a new checkbox
btnUpdate.ID = "btnUpdate";
btnUpdate.Text = "Update Selected";
btnUpdate.OnClientClick = "ValidateCheckBox()";
btnUpdate.Click += new EventHandler(btnUpdateSelected_Click);
headerItem["Update"].Controls.Add(btnUpdate); // adding the checkbox to the control collection of the required cell
btnUpdate.Visible = true;
}
if (e.Item is GridFilteringItem)
{
ImageButton ExportToXLSButton = new ImageButton();
ExportToXLSButton.ID = "CustomExportToExcelButton";
ExportToXLSButton.AlternateText = ExportToXLSButton.ToolTip = "Export To Excel";
ExportToXLSButton.ImageUrl = "~/images/ExportToExcel.gif";
ExportToXLSButton.CommandName = RadGrid.ExportToExcelCommandName;
(e.Item as GridFilteringItem)["Update"].Controls.Add(ExportToXLSButton);
}
}

In ItemCommand

if (e.CommandName == RadGrid.ExportToExcelCommandName)
{
grid.ExportSettings.FileName = String.Format("X_{0}_to_{1}",
dtStart.SelectedDate.Value.ToString("MM-dd-yyyy"), dtEnd.SelectedDate.Value.ToString("MM-dd-yyyy"));
{
if (col.UniqueName != "X")
{
col.Visible = true;
}
}

grid.ExportSettings.ExportOnlyData = true;
grid.ExportSettings.IgnorePaging = true;
grid.ExportSettings.OpenInNewWindow = true;
grid.Rebind();
grid.MasterTableView.ExportToExcel();


I had even referred to the below links but i could not find any solution for this

http://www.telerik.com/forums/radgrid-export-to-excel-problem

http://www.telerik.com/help/aspnet-ajax/grid-export-with-ajax-enabled.html 

http://www.telerik.com/help/aspnet-ajax/ajax-exclude

Please help me out on this issue

Thanks
Saurabh
Top achievements
Rank 1
 answered on 02 Dec 2014
9 answers
110 views
Hello,

I have implemented a radscheduler with a grid and drag/drop functionality much like your sample here:
http://demos.telerik.com/aspnet-ajax/scheduler/examples/draganddropintegration/defaultcs.aspx?product=scheduler

The only difference is I don't bind the grid with a datasource but in the onneeddatasource event in code behind.
Everything is working great exept that when I delete an appointment I want the grid to rebind because the deleted item should reappear in the grid.

On which event do I call the Rebind event of the grid? I tried the AppointmentDelete but it seems to be to early.

Thanks,

Frank
Frank
Top achievements
Rank 1
 answered on 02 Dec 2014
2 answers
184 views
I've implemented a grid with toolbar and a filtering option. I'd like to turn the grids filter on and off when clicking the toolbar button "Filter".

Here is the aspx code and the JS function being called on client click. Most of it is from the forum or the documentation:

            
<telerik:RadToolBar runat="server" ID="RadToolBar1" OnClientButtonClicked="onButtonClicked"
EnableViewState="False" ResolvedRenderMode="Classic" SingleClick="none">
    <Items>
        <telerik:RadToolBarButton Text="Open" ImageUrl="~/Images/reply.gif"
            CommandName="openMail" />
        <telerik:RadToolBarButton IsSeparator="true" />
        <telerik:RadToolBarButton CommandName="showFilter" Text="Filter" CheckOnClick="True">
        </telerik:RadToolBarButton>
    </Items>
</telerik:RadToolBar>


function onButtonClicked(sender, args) {
    var commandName = args.get_item().get_commandName();
    if (commandName == "showFilter") {
        if (tbButton.get_checked()) {
            alert("checked")
            $find('<%=RadGrid1.ClientID %>').get_masterTableView().hideFilterItem();
        } else {
            alert("unchecked")
            $find('<%=RadGrid1.ClientID %>').get_masterTableView().showFilterItem();
        }
    }
}

And I have some code handling other button clicks in VB.

Private Sub RadToolBar1_ButtonClick(sender As Object, e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick
 
    Dim tbBtn As RadToolBarButton = TryCast(e.Item, RadToolBarButton)
 
    Select Case tbBtn.CommandName.ToLower
        Case "openmail"
            OnMessageListSelectionChanged(displayedID, True, False)
    End Select
 
End Sub


My problem is that tbButton.get_checked() always returns true. No matter what the current state is. I assume that there is a second request setting it back... Any ideas how to solve it? Or what exactly the problem is?

Thanks a lot in advance.
Martin
Top achievements
Rank 1
 answered on 02 Dec 2014
4 answers
329 views
Hi All,

I have an ajaxified grid for which I'm trying to add a button to a certain group header.  In this case I'm just trying to display the button where the Display Name is.

  <telerik:GridGroupByExpression><br>                                        <GroupByFields><br>                                            <telerik:GridGroupByField FieldName="DisplayName" FieldAlias="DisplayName" HeaderText="Employee"<br>                                                HeaderValueSeparator=": " Aggregate="None" /><br>                                            <telerik:GridGroupByField FieldName="UserId" FieldAlias="UserId" HeaderText="" HeaderValueSeparator=""<br>                                                Aggregate="None" /><br>                                            <telerik:GridGroupByField FieldName="CheckNumber" FieldAlias="CheckNumber" HeaderText=""<br>                                                HeaderValueSeparator="" Aggregate="None" /><br>                                            <telerik:GridGroupByField FieldName="appliedToDate" FieldAlias="appliedToDate" HeaderText=""<br>                                                HeaderValueSeparator="" Aggregate="None" /><br>                                            <telerik:GridGroupByField FieldName="PaidDate" FieldAlias="PaidDate" HeaderText=""<br>                                                HeaderValueSeparator="" Aggregate="None" /><br>                                            <telerik:GridGroupByField FieldName="LineHeaderID" FieldAlias="LineHeaderID" HeaderText=""<br>                                                HeaderValueSeparator="" Aggregate="None" /><br>                                        </GroupByFields><br>                                        <SelectFields><br>                                            <telerik:GridGroupByField FieldName="DisplayName" FieldAlias="DisplayName" HeaderText="Employee"<br>                                                HeaderValueSeparator=": " Aggregate="None" /><br>                                            <telerik:GridGroupByField FieldName="RequestedAmount" FieldAlias="RequestedAmount"<br>                                                HeaderText="<br />Requested Total" HeaderValueSeparator=": $" Aggregate="Sum" /><br>                                            <telerik:GridGroupByField FieldName="ApprovedAmount" FieldAlias="ApprovedAmount"<br>                                                HeaderText="Approved Total" HeaderValueSeparator=": $" Aggregate="Sum" /><br>                                        </SelectFields><br>                                    </telerik:GridGroupByExpression><br>                                    <telerik:GridGroupByExpression><br>                                        <GroupByFields><br>                                            <telerik:GridGroupByField FieldName="Category" FieldAlias="Category" HeaderText="Category"<br>                                                HeaderValueSeparator=": " Aggregate="None" /><br>                                        </GroupByFields><br>                                        <SelectFields><br>                                            <telerik:GridGroupByField FieldName="CategoryText" FieldAlias="CategoryText" HeaderText="Category"<br>                                                HeaderValueSeparator=": " Aggregate="None" /><br>                                            <telerik:GridGroupByField FieldName="RequestedAmount" FieldAlias="RequestedAmount"<br>                                                HeaderText="Requested Total" HeaderValueSeparator=": $" Aggregate="Sum" /><br>                                            <telerik:GridGroupByField FieldName="ApprovedAmount" FieldAlias="ApprovedAmount"<br>                                                HeaderText="Total" HeaderValueSeparator=": $" Aggregate="Sum" /><br>                                        </SelectFields><br>                                    </telerik:GridGroupByExpression><br>                                    <telerik:GridGroupByExpression><br>                                        <GroupByFields><br>                                            <telerik:GridGroupByField FieldName="order_no" FieldAlias="order_no" HeaderText="Order Number"<br>                                                HeaderValueSeparator=": " Aggregate="None" /><br>                                        </GroupByFields><br>                                        <SelectFields><br>                                            <telerik:GridGroupByField FieldName="order_no" FieldAlias="order_no" HeaderText="Order Number"<br>                                                HeaderValueSeparator=": " Aggregate="None" /><br>                                            <telerik:GridGroupByField FieldName="RequestedAmount" FieldAlias="RequestedAmount"<br>                                                HeaderText="Requested Total" HeaderValueSeparator=": $" Aggregate="Sum" /><br>                                            <telerik:GridGroupByField FieldName="ApprovedAmount" FieldAlias="ApprovedAmount"<br>                                                HeaderText="Total" HeaderValueSeparator=": $" Aggregate="Sum" /><br>                                        </SelectFields><br>                                    </telerik:GridGroupByExpression><br><br><br> <GroupHeaderTemplate><br>                                    <asp:Panel runat="server" ID="pnlEmployee" Visible='<%# ((((GridGroupHeaderItem)Container).AggregatesValues["DisplayName"]) != null)%>'<br>                                        Style="height: 20px !important"><br>                                        <asp:Label runat="server" ID="lblEmployee" Text='<%# "Employee: " +Eval("DisplayName")  %> '><br>                                        </asp:Label><br>                                    </asp:Panel><br>                                    <asp:Label runat="server" ID="lblCategory" Text='<%# "Category: "+ (((GridGroupHeaderItem)Container).AggregatesValues["CategoryText"]) %>'<br>                                        Visible='<%# ((((GridGroupHeaderItem)Container).AggregatesValues["CategoryText"]) != null)%>'<br>                                        Style="margin-right: 30px;"></asp:Label><br>                                    <asp:Label runat="server" ID="lblOrderNo" Text='<%# "Order Number: "+ (((GridGroupHeaderItem)Container).AggregatesValues["order_no"]) %>'<br>                                        Visible='<%# ((((GridGroupHeaderItem)Container).AggregatesValues["order_no"]) != null)%>'<br>                                        Style="margin-right: 30px;"></asp:Label><br>                                    <asp:Label runat="server" ID="lblRequestedTotal" Text='<%# "Requested Total: $"+ (((GridGroupHeaderItem)Container).AggregatesValues["RequestedAmount"]) %>'<br>                                        Visible='<%# ((((GridGroupHeaderItem)Container).AggregatesValues["RequestedAmount"]) != null)%>'<br>                                        Style="margin-left: 30px;"></asp:Label><br>                                    <asp:Label runat="server" ID="lblApprovedTotal" Text='<%# "Approved Total: <b>$" + (((GridGroupHeaderItem)Container).AggregatesValues["ApprovedAmount"]) + "</b></br>" %>'<br>                                        Visible='<%# ((((GridGroupHeaderItem)Container).AggregatesValues["ApprovedAmount"]) != null)%>'<br>                                        Style="margin-left: 30px;"><br>                                       <br>                                    </asp:Label><br>                                </GroupHeaderTemplate>


I have in the itemCreated added that button:
protected void rgLineItems_ItemCreated(object sender, GridItemEventArgs e)<br>   
{<br>       
        if (e.Item is GridGroupHeaderItem && e.Item.GroupIndex.Split('_').Length == 1)<br>
        {<br> 
           GridGroupHeaderItem hi = e.Item
as GridGroupHeaderItem;<br>
            DataRowView drv = ((DataRowView)e.Item.DataItem);<br>
            Button btn =
new Button();<br>
            btn.ID =
"btnUpdateHeader";<br>
            btn.Text =
string.IsNullOrWhiteSpace(drv["PaidDate"].ToString()) ? "Pay Employee" : "Update Payment";<br>
            btn.CommandArgument = drv[
"UserID"].ToString() + "/" + (string.IsNullOrWhiteSpace(drv["PaidDate"].ToString()) ? "-1" : drv["LineHeaderID"].ToString());<br> 
           btn.OnClientClick =
"if (!confirm('Are you sure you all information is correct for this employee?')) return false;";<br>
           btn.Style.Add(HtmlTextWriterStyle.MarginLeft,
"20px");<br>
           btn.CommandName =
"PayEmployee";<br>
           hi.Cells[hi.Cells.Count - 2].Controls.Add(btn);<br>
           btn.Click +=
new EventHandler(btnPayEmployee_Click);<br>
       }<br>
 }

However the btn.Click event isn't firing.  I've also tried the command name and using the radgrid Item command without success.  

Any advice?
Eyup
Telerik team
 answered on 02 Dec 2014
1 answer
168 views
I have used Batch Edit in Radgrid , when i click on cell in radgrid textbox is appearing instead of radcombobox. value every thing is binding properly but dropdown is not appearing, if i click on cell.  I am creating dynamic grid. Code given below.

 RadGrid grd = new RadGrid();
                            //grd.PreRender += new EventHandler(grd_PreRender);
                            grd.NeedDataSource += new GridNeedDataSourceEventHandler(grd_NeedDataSource);

                            grd.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                            //OnetimeRevision
                            if (_isPartLevelEditable)
                            {
                                if (UserManager.IsAdminOrPM(UserRepository.CurrentUser))
                                //(SessionManager.LoginUser.Role == Constants.ADMINROLE || SessionManager.LoginUser.Role == Constants.PROGRAMMANAGERROLE)
                                {
                                    if (_ecr != null)
                                    {
                                        if (_ecr.EcrState == Constants.ECRSTATUSINITIATE || _ecr.EcrState == Constants.ECRSTATUSECOINITIATED || _ecr.EcrState == Constants.ECRSTATUSKICKEDOFF || _ecr.EcrState == Constants.ECRSTATUSIMPLEMENTED || _ecr.EcrState == Constants.ECRSTATUSCOMPLETE)
                                        {
                                            grd.UpdateCommand += new GridCommandEventHandler(grdCurrentAffectedPart_UpdateCommand);
                                        }
                                        if (_ecr != null && _ecr.EcrState == Constants.ECRSTATUSINITIATE)
                                        {
                                            grd.DeleteCommand += new GridCommandEventHandler(grd_DeleteCommand);
                                        }
                                    }
                                    else
                                    {
                                        grd.UpdateCommand += new GridCommandEventHandler(grdCurrentAffectedPart_UpdateCommand);
                                        grd.DeleteCommand += new GridCommandEventHandler(grd_DeleteCommand);
                                    }
                                }
                                grd.ItemDataBound += new GridItemEventHandler(grd_ItemDataBound);
                                grd.MasterTableView.EditMode = GridEditMode.Batch;
                                grd.MasterTableView.AllowAutomaticInserts = true;
                                grd.MasterTableView.AllowAutomaticUpdates = true;
                                grd.MasterTableView.AllowAutomaticDeletes = true;
                                grd.MasterTableView.BatchEditingSettings.EditType = GridBatchEditingType.Cell;

                                //grd.MasterTableView.BatchEditingSettings.EditType = Cell;
                                // grd.MasterTableView.EditFormSettings.PopUpSettings.Modal = true;
                                //popup borders and color
                                // grd.MasterTableView.EditFormSettings.FormStyle.BorderWidth = Unit.Pixel(5);
                                //string hexvalue="#7da5e0";
                                // grd.MasterTableView.EditFormSettings.FormStyle.BorderColor = System.Drawing.ColorTranslator.FromHtml(hexvalue);
                                //---
                                //if (_ecr != null)
                                //{
                                //    grd.MasterTableView.EditFormSettings.CaptionFormatString = UIMessages.FinancalLinfoEcNumber + Constants.SPACE + _ecr.EcrNumber;
                                //}
                                grd.ClientSettings.Selecting.AllowRowSelect = true;
                                grd.ClientSettings.Scrolling.AllowScroll = true;
                                //grd.ClientSettings.ClientEvents.OnPopUpShowing = "OnPopUpShowing";                                
                                //set attributes for pre/ecr/release part level collumn ordinal as comma sepearate
                            }
                            grd.ItemCreated += new GridItemEventHandler(grd_ItemCreated);
                            grd.MasterTableView.CommandItemSettings.ShowRefreshButton = false;
                            grd.Attributes.Add(Constants.ENABLELINQEXPRESSIONS, Constants.FALSE);
                            grd.ColumnCreated += new GridColumnCreatedEventHandler(grdCurrentAffectedPart_ColumnCreated);

                            grd.ID = dsEcrParts.Tables[i].TableName;
                            //grd.MasterTableView.EditFormSettings.InsertCaption = _ecr.EcrNumber;
                            grd.Attributes.Add(Constants.INDEXTEXT, i.ToString(CultureInfo.InvariantCulture));
                            grd.MasterTableView.DataKeyNames = new string[] { Constants.ECRPARTID, Constants.ECRID, Constants.PARTPRODUCTIONSOURCEID, "ChildParts" };
                            grd.Width = 1400;
                            grd.Height = Unit.Percentage(100);
                            grd.MasterTableView.Width = Unit.Percentage(100);
                            grd.MasterTableView.Height = Unit.Percentage(100);
                            grd.ClientSettings.Scrolling.AllowScroll = true;
                            // grd.ClientSettings.Scrolling.UseStaticHeaders = true;
                            int freezeColumnCount = 7;
                            int.TryParse(ConfigurationManager.AppSettings[Constants.ECRFREEZECOLUMNSCOUNT], out freezeColumnCount);
                            grd.ClientSettings.Scrolling.FrozenColumnsCount = freezeColumnCount;

                            SetEditableColumns(dsEcrParts.Tables[i], grd, _ecr);
                            if (UserManager.IsAdminOrPM(UserRepository.CurrentUser))
                            //(SessionManager.LoginUser.Role == Constants.ADMINROLE || SessionManager.LoginUser.Role == Constants.PROGRAMMANAGERROLE)
                            {
                                if (_ecr != null)
                                {

                                    //Production Y && Main ECR and States = I or O or K or M then add edit column else no edit
                                    //production N && Main ECR && states = I or O then add edit else no edit
                                    //SUB ECR && PRODUCTION = Y AND STATES = I OR O OR M THEN ADD EDIT COLUMN ELSE NO EDIT COLUMN
                                    //shyam (IsProduction in ECR)
                                    //OnetimeRevision
                                    if (
                                        (!_ecr.SubEcr && ((_ecr.EcrState == Constants.ECRSTATUSINITIATE || _ecr.EcrState == Constants.ECRSTATUSECOINITIATED)
                                        || (_ecr.IsProduction && (_ecr.EcrState == Constants.ECRSTATUSKICKEDOFF || _ecr.EcrState == Constants.ECRSTATUSIMPLEMENTED))))
                                        || (_ecr.SubEcr && _ecr.IsProduction && (_ecr.EcrState == Constants.ECRSTATUSECOINITIATED || _ecr.EcrState == Constants.ECRSTATUSKICKEDOFF || _ecr.EcrState == Constants.ECRSTATUSIMPLEMENTED))////If not sub ecr then  editable at initate stage as well
                                        || (!_ecr.SubEcr && _ecr.RevisionInProgress && ((!_ecr.IsProduction && _ecr.EcrState == Constants.ECRSTATUSIMPLEMENTED) || (_ecr.EcrState == Constants.ECRSTATUSCOMPLETE)))
                                        ) //If sub ecr then not editable at initate stage or evaluate stage
                                    {
                                        AddEditColumn(grd);

                                    }
                                    if (_ecr != null && _ecr.EcrState == Constants.ECRSTATUSINITIATE)
                                    {
                                        AddDeleteColumn(grd);

                                    }
                                }
                                else
                                {
                                    AddEditColumn(grd);
                                    AddDeleteColumn(grd);

                                }
                            }
                            if (i == 0)
                            {
                                AddGridCollectionTitle(Constants.LBLAFFECTEDPARTS, UIMessages.AffectedParts);
                            }
                            else if (i == 1)
                            {
                                AddGridCollectionTitle(Constants.LBLPARENTPARTS, UIMessages.ParentParts);
                            }
                            PlaceHolder1.Controls.Add(grd);
                            PlaceHolder1.Controls.Add(new LiteralControl(Constants.BREAKTAG));
                            grd.Rebind();


    protected void grd_ItemDataBound(object sender, GridItemEventArgs e)
        {
            RadGrid senderGrid = (RadGrid)sender;
            List<string> editabeColumns = (List<string>)_columnOrdinal[sender];

            if (e.Item is GridDataItem)
            {
                GridDataItem dataItem = e.Item as GridDataItem;
                if (e.Item.OwnerTableView.Columns.FindByUniqueNameSafe(Constants.DELETECOLUMN) != null)
                {
                    ImageButton img = dataItem[Constants.DELETECOLUMN].Controls[0] as ImageButton;
                    if (dataItem[Constants.DELETECOLUMN].Controls.Count > 0)
                    {
                        //ECR ECRNumber = null;
                        //int ecrId = 0;
                        //if (ECRId.Length > 0 && ECRId != Constants.ZeroNumber)
                        //{
                        //    ecrId = Convert.ToInt32(ECRId);
                        //    using (var ecrManager = new ECRECOManager())
                        //    {
                        //        ECRNumber = ecrManager.FindECR(Convert.ToDecimal(ECRId));
                        //    }
                        //    string deleteMessage = UIMessages.Delete + "  - " + UIMessages.FinancalLinfoEcNumber + "  " + ECRNumber.EcrNumber;
                        //    img.Attributes.Add(Constants.ONCLICK, string.Format(CultureInfo.CurrentUICulture, Constants.POPUPCONFIRM, senderGrid.ClientID, UIMessages.RADGRIDCONFIRMDELETEECRPARTSCRIPT, deleteMessage));
                        //}
                        //else
                        img.Attributes.Add(Constants.ONCLICK, string.Format(CultureInfo.CurrentUICulture, Constants.POPUPCONFIRM, senderGrid.ClientID, UIMessages.RADGRIDCONFIRMDELETEECRPARTSCRIPT, UIMessages.Delete));

                        //"if(!$find('" + senderGrid.ClientID + "').confirm('" + UIMessages.RADGRIDCONFIRMDELETEECRPARTSCRIPT + "', event, 'Delete'))return false;");
                        //dataItem[Constants.DELETECOLUMN].Attributes.Add(UIMessages.ONCLICK, string.Format(UIMessages.RADGRIDCONFIRMDELETEECRPARTSCRIPT, senderGrid.ClientID));
                        img.ToolTip = UIMessages.Delete;

                        if (dataItem["IsDeletable"].Text.Trim() == "0")
                        {
                            dataItem[Constants.DELETECOLUMN].Text = string.Empty;
                        }
                    }
                    if (senderGrid.Attributes[Constants.INDEXTEXT].Equals(Constants.ZeroNumber))
                        if ((dataItem.DataItem as DataRowView).Row.Table.Rows.Count == 1)
                            img.Visible = false;
                }

                if (e.Item.OwnerTableView.Columns.FindByUniqueNameSafe(Constants.EDITCOLUMN) != null)
                {
                    if (dataItem[Constants.EDITCOLUMN].Controls.Count > 0)
                    {
                        ImageButton editBtn = (ImageButton)dataItem[Constants.EDITCOLUMN].Controls[0];
                        //editBtn.ToolTip = UIMessages.Edit;
                        editBtn.Visible = false;
                    }
                }

            }
            if (e.Item is GridHeaderItem)
            {
                try
                {
                    GridHeaderItem dataItem = e.Item as GridHeaderItem;
                    /*  dataItem[Constants.PREECRPARTNUMBER].Style.Add("border-left", "2px solid #3663bd");
                      dataItem[Constants.ECRPARTNUMBER].Style.Add("border-left", "2px solid #3663bd");
                      dataItem[Constants.RELEASEDPARTNUMBER].Style.Add("border-left", "2px solid #3663bd");*/
                    dataItem.Style.Add("border-left", "2px solid #3663bd");
                }
                catch
                {
                }
            }
            GridEditableItem editedItem = e.Item as GridEditableItem;
            //if (e.Item.IsInEditMode)
            //{
            //    GridEditFormItem editform = (GridEditFormItem)e.Item;
            //    if (_ecr != null)
            //    {
            //        ((System.Web.UI.WebControls.TableCell)(editform.Controls[1].Controls[0].Controls[1].Controls[0].Controls[0].Controls[0])).Text =
            //            (_ecr.EcrState == Constants.ECRSTATUSINITIATE) ? "<b>" + UIMessages.ECREditHeader + "</b>" : "<b>" + UIMessages.ECOEditHeader + "</b>";
            //    }
            //    else
            //    {
            //        ((System.Web.UI.WebControls.TableCell)(editform.Controls[1].Controls[0].Controls[1].Controls[0].Controls[0].Controls[0])).Text =

            //     "<b>" + UIMessages.ECREditHeader + "</b><b>" + UIMessages.ECOEditHeader + "</b>";
            //    }



            //    // editform.EditFormCell.
            //}
            if (editedItem != null && e.Item.IsInEditMode)
            {
                //Find the row being edited in the session stored DataSet
                decimal partID = Convert.ToDecimal(editedItem.GetDataKeyValue(Constants.PARTPRODUCTIONSOURCEID));

                DataRow editRow = ECRPartsSession.Tables[senderGrid.ID].Select(string.Format(CultureInfo.InvariantCulture, Constants.SEARCHPARTFILTER, partID)).First();
                //editedItem[Constants.AFFECTEDPART].Enabled = false;
                //Fill editable TextBoxes
                foreach (string columnName in editabeColumns)
                {
                    //Fill ECRType DropDown
                    if (columnName.Equals(Constants.ECRTYPE))
                    {
                        string ecrType = editRow[Constants.ECRTYPE].ToString();
                        RadComboBox combo = (RadComboBox)editedItem.FindControl(senderGrid.ID + Constants.ECRTYPE);

                        combo.Focus();
                        if (combo != null)
                        {
                            FillAccessDropDown(combo, ecrType);
                            if (ecrType == Constants.ECRPARTLEVELTYPEPREECR)
                            {
                                //combo.SelectedIndex = combo.FindItemIndexByValue(Constants.ECRTYPEADD);
                                combo.SelectedValue = Constants.ECRTYPEADD;
                            }
                            else
                            {
                                //combo.SelectedIndex= combo.FindItemIndexByText("O");
                                combo.SelectedValue = ecrType == "O" ? "D" : ecrType;
                            }
                        }

                    }
                    //Fill ToolSource location DropDowns
                    else if (_toolSourcelocationColumns.Contains(columnName) && !Production)
                    {
                        if ((editedItem.OwnerTableView.AutoGeneratedColumns.Any(gc => gc.UniqueName == columnName)))
                        {
                            if (editedItem[columnName] != null) //&& editedItem[locationColumn].Controls.Count <= 1)
                            {
                                RadComboBox comboLocTool = (RadComboBox)editedItem.FindControl(senderGrid.ID + columnName);
                                if (comboLocTool != null)
                                {
                                    FillLocation(comboLocTool, _toolSource, editRow[columnName]);
                                    RadComboBoxItem foundItem = null;
                                    string valueColumn = columnName.Replace(Constants.NAME, string.Empty);
                                    foundItem = comboLocTool.FindItemByValue(Convert.ToString(((editedItem.DataItem as DataRowView))[valueColumn]));
                                    if (comboLocTool.Items.Contains(foundItem))
                                    {
                                        comboLocTool.SelectedValue = foundItem.Value;// ((editedItem.DataItem as DataRowView))[valueColumn].ToString();
                                    }
                                }
                            }
                        }
                    }
                    //Fill FixtureSource location DropDowns
                    else if (_fixtureSourcelocationColumns.Contains(columnName) && !Production)
                    {
                        if ((editedItem.OwnerTableView.AutoGeneratedColumns.Any(gc => gc.UniqueName == columnName)))
                        {
                            if (editedItem[columnName] != null) //&& editedItem[locationColumn].Controls.Count <= 1)
                            {
                                RadComboBox comboLocTool = (RadComboBox)editedItem.FindControl(senderGrid.ID + columnName);
                                if (comboLocTool != null)
                                {
                                    FillLocation(comboLocTool, _fixtureSource, editRow[columnName]);
                                    RadComboBoxItem foundItem = null;
                                    string valueColumn = columnName.Replace(Constants.NAME, string.Empty);
                                    foundItem = comboLocTool.FindItemByValue(Convert.ToString(((editedItem.DataItem as DataRowView))[valueColumn]));
                                    if (comboLocTool.Items.Contains(foundItem))
                                    {
                                        comboLocTool.SelectedValue = foundItem.Value;// ((editedItem.DataItem as DataRowView))[valueColumn].ToString();
                                    }
                                }
                            }
                        }
                    }
                    //Fill ProductionSource location DropDowns
                    else if (_productionSourcelocationColumns.Contains(columnName))
                    {
                        if ((editedItem.OwnerTableView.AutoGeneratedColumns.Any(gc => gc.UniqueName == columnName)))
                        {
                            if (editedItem[columnName] != null) //&& editedItem[locationColumn].Controls.Count <= 1)
                            {
                                RadComboBox comboLocProd = (RadComboBox)editedItem.FindControl(senderGrid.ID + columnName);
                                if (comboLocProd != null)
                                {
                                    FillLocation(comboLocProd, _productionSource, editRow[columnName]);
                                    RadComboBoxItem foundItem = null;
                                    string valueColumn = columnName.Replace(Constants.NAME, string.Empty);
                                    foundItem = comboLocProd.FindItemByValue(Convert.ToString(((editedItem.DataItem as DataRowView))[valueColumn]));
                                    if (comboLocProd.Items.Contains(foundItem))
                                    {
                                        comboLocProd.SelectedValue = foundItem.Value;// ((editedItem.DataItem as DataRowView))[Constants.ECRPRODUCTIONSOURCE].ToString();
                                    }
                                }
                            }
                        }
                    }

                    //Fill Date fields
                    else if (_dateFields.Contains(columnName) && Production)
                    {
                        if ((editedItem.OwnerTableView.AutoGeneratedColumns.Any(gc => gc.UniqueName == columnName)))
                        {
                            if (editedItem[columnName] != null) //&& editedItem[locationColumn].Controls.Count <= 1)
                            {
                                RadDatePicker rdpDate = editedItem[columnName].Controls[0] as RadDatePicker;
                                if (rdpDate != null)
                                {
                                    if (!string.IsNullOrEmpty(Convert.ToString(editRow[columnName])))
                                        rdpDate.SelectedDate = Convert.ToDateTime(Convert.ToString(editRow[columnName]));
                                    if (columnName == Constants.BASELINEMRDTOPLANTDATE || columnName == Constants.BASELINEPPAPDATE)
                                    {
                                        rdpDate.ClientEvents.OnDateSelected = "GMS.Masters.ECR.Part.ecoBaselineDateSelected";
                                    }
                                    if (columnName == Constants.PLANMRDTOPLANTDATE || columnName == Constants.PLANPPAPDATE)
                                    {
                                        if (rdpDate.SelectedDate == null)
                                            rdpDate.Attributes.Add("HasValue", "false");
                                        else
                                            rdpDate.Attributes.Add("HasValue", "true");
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if ((editedItem.OwnerTableView.AutoGeneratedColumns.Any(gc => gc.UniqueName == columnName)))
                        {
                            if (editedItem[columnName] != null) //&& editedItem[columnName].Controls.Count <= 1)
                            {
                                RadTextBox txtBox = (RadTextBox)editedItem.FindControl(senderGrid.ID + columnName);
                                if (txtBox != null)
                                {
                                    txtBox.Text = Convert.ToString(editRow[columnName]);
                                    //txtBox.ClientEvents.OnValueChanged = "debugger;OnTextValueChanged();";
                                   // txtBox.Attributes.Add("onchange", "debugger;return GMS.ECR.ManageEcrEco.OnTextValueChanged();");
                                }
                            }
                        }
                    }
                }
            }
        }
Konstantin Dikov
Telerik team
 answered on 02 Dec 2014
6 answers
2.0K+ views
Hello,

I seem to be getting the following script error when trying to display a tooltip at a required location on the screen.

Sys.ArgumentOutOfRangeException: Value must be an integer. Parameter name: x Actual value was -194.80000019073486.

The error is generated within the function Sys$UI$Bounds(x, y, width, height).

It seems that the error can be generated by changing the zoom level within Internet Explorer. If the zoom level is 100% then the resolution of the screen is mapped 1-to-1 based on the video card resolution. If the zoom level is changed to 150% (in our example), then the video card resolution no longer corresponds to a 1-to-1 mapping based on the zoom level set within Internet Explorer. As a result, x and y values on the screen generate decimal values instead of integer values and thus the exception occurs.

Any help in resolving this issue would be appreciated.

Thanks,
Tony

​
Marin Bratanov
Telerik team
 answered on 01 Dec 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?