Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
132 views

Hi,

   I have set up some code that fires when the "save changes" link it clicked during a batchedit session. The only goal I have here is to set the border color to red if the number entered does not fall into a certain range. I've left the test for the range out of the code below because it isn't important. 

  I have looked through countless telerik posts and finally came upon a line of code to set the bordercolor of the cell to red that doesn't blow up and tell me that some part of the line of code has a property or method that doesn't exist in the idcell object (see below); the line of code does execute with no error:

idCell.style.backgroundColor == "red";

However the cell border does not turn red;

I am confident that the code I'm using does access the cell because this line does work:

  var id = batchManager.getCellValue(idCell);

So basically I can't figure out how to turn the border color to red. Here is a boiled down version of the code to give you an idea of what code I'm using. Any help would be appreciated:

if (args.get_commandName() == "BatchEdit") {
                var masterTable = sender.get_masterTableView();
                var batchManager = sender.get_batchEditingManager();
                var dataItems = masterTable.get_dataItems();
                var idCell = dataItems[i].get_cell("LINE")
                var id = batchManager.getCellValue(idCell);
                var regexpString = "^\\d+\\.\\d{0,decimal}$";
                var fieldValid = regexp.test(id);
                if (fieldValid)
                    batchManager.changeCellValue(idCell, id);
                idCell.style.backgroundColor == "red"; //THIS DOES NOT TURN TO BORDER TO RED
}

 

Vessy
Telerik team
 answered on 27 Jan 2020
0 answers
59 views

Over the last few weeks we've started to get reports from multiple users that have a radwindow sizing issue on Apple Mobile devices. When the window launches it launches off the screen and the scroll doesn't work. We've isolated it to instances where the button that launches the radwindow is below radtabs or a block of text. It is as if the device can no longer find the window size/location. The same radwindows worked fine before the most recent Apple IOS update. We can replicate the issue on updated Apple iPhones and can replicate that the issue doesn't happen on Apple iPhones without the update. 

 

Is there something we can do to overcome the issue?

Jeff
Top achievements
Rank 1
 asked on 25 Jan 2020
1 answer
402 views

I have a GridBoundColumn in my RadGrid that displays a true or false value. In the database, this is stored as a 1 or a 0. During the ItemDataBound event, I check the incoming value for this column and override it to either be the string "TRUE" or the string "FALSE". However, the RadGrid is still identifying the column's datatype as an integer so the filter menu doesn't have certain filtering options like "Contains". I tried to manually set the DataType to "System.String" on both the column itself and during the ItemDataBound event and, while this provides me the filter menu I want, the functions inside don't work (clicking "contains", for example, does nothing at all). 

 

Is there anyway for me to force the filter options to match the values after DataBound?

 

Thanks!

Eyup
Telerik team
 answered on 24 Jan 2020
1 answer
211 views

Dear All,

 

i am trying to create form as amount inputter, using RadNumericText and CompareValidator (to compare min max value between RadNumeric) through code behind. CompareValidator work perfectly where value of RadNumeric doesn't contain digit behind commas (attached images : data no 1), but, when i'm inputted value with commas, it's doesn't working as expected, as shown in the attached images.

No         City               Min                     Max

1            Aceh             $ 100.001,00      $ 100.000,00

                                                               *Amount min cannot be greater than amount max

2.           Yogya           $ 100.000,00      $ 100.000,00

 

3.           Banten         $ 100.000,88      $ 100.000,99

                                                             *Amount min cannot be greater than amount max

 

From data above, no 1, CompareValidator working perfectly, but not for data no 3, where value has any digit behind commas. Any advice how to compare min max value with commas at data no 3 ?

 

Regard,

 

Ragil

 

protected RadNumericTextBox mytextbox;
 
public void InstantiateIn(System.Web.UI.Control container)
{
    mytextbox = new RadNumericTextBox();
    mytextbox.AutoPostBack = false;
    mytextbox.ID = rankName + typeName + "MyTextBox";
    mytextbox.NumberFormat.DecimalDigits = 2;
    mytextbox.NumberFormat.GroupSeparator = ".";
    mytextbox.NumberFormat.DecimalSeparator = ",";
    mytextbox.Type = NumericType.Currency;
    //mytextbox.DataType = "System.Decimal";
 
    reqValid = new RequiredFieldValidator();
    reqValid.ForeColor = System.Drawing.Color.Red;
    reqValid.ErrorMessage = "* Required field";
    reqValid.CssClass = "has-error";
    reqValid.ControlToValidate = rankName + typeName + "MyTextBox";
    reqValid.Display = ValidatorDisplay.Dynamic;
 
    if (typeName == "Max")
    {
        compValid = new CompareValidator();
        compValid.ForeColor = System.Drawing.Color.Red;
        compValid.ErrorMessage = "* Amount Min can not be greater than Amount Max";
        compValid.CssClass = "has-error";
        compValid.Display = ValidatorDisplay.Dynamic;
 
        compValid.ControlToValidate = rankName + "Max" + "MyTextBox";
        compValid.ControlToCompare = rankName + "Min" + "MyTextBox";
        compValid.Operator = ValidationCompareOperator.GreaterThanEqual;
        compValid.Type = ValidationDataType.Currency;
        compValid.ValidationGroup = "ValidateAmount";
 
    }
 
    container.Controls.Add(mytextbox);
    container.Controls.Add(reqValid);
 
    if (typeName == "Max")
    {
        container.Controls.Add(compValid);
    }
}
Attila Antal
Telerik team
 answered on 23 Jan 2020
5 answers
550 views

Hello,

I have a radcombobox, and when I disable it, I can still enter text in the textbox. How can I also disable the textbox so no text can be enter when my combobox is desabled ?

Thanx for your help.

Rumen
Telerik team
 answered on 23 Jan 2020
4 answers
427 views
I have the following Grid on a form:

    <telerik:RadGrid ID="rgd_TaskPermissions" runat="server"  GridLines="None" AutoGenerateColumns="False" Width="320px">
    <MasterTableView>
        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
        <RowIndicatorColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
        <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="Object" HeaderText="Table" 
                    SortExpression="Object" UniqueName="Object" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Select" HeaderText="Select" 
                    SortExpression="Select" UniqueName="Select" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Update" HeaderText="Update" 
                    SortExpression="Update" UniqueName="Update" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Insert" HeaderText="Insert" 
                    SortExpression="Insert" UniqueName="Insert" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Delete" HeaderText="Delete" 
                    SortExpression="Delete" UniqueName="Delete" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn UniqueName="TemplateColumn">
                    <ItemTemplate
                    <asp:Button ID="btn_ModifyPerms" runat="server" Text="Modify"  />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
    </MasterTableView>
</telerik:RadGrid>

I fill the grid by calling a Stored Procedure in SQL

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    Label1.Text = Session("Object")
    rgd_TaskPermissions.DataSource = GetPermissions()
    rgd_TaskPermissions.DataBind()
End Sub
Private Function GetPermissions() As DataTable
    Dim Table As String = Session("Object")
    Dim DatabaseName As String = Session("DBName")
    Dim Grantee As String = Session("TaskRole")
    Dim connectionString = New SqlConnection("server=DO-IT-AB\MSSQLAB;database=AeriesAdmin;UID=XXX;PWD=XXX;")
    Dim command = New SqlCommand("aa_task_table_permissions_by_object", connectionString)
    command.CommandType = CommandType.StoredProcedure
    command.Parameters.Add("@DBName", SqlDbType.VarChar).Value = DatabaseName
    command.Parameters.Add("@Grantee", SqlDbType.VarChar).Value = Grantee
    command.Parameters.Add("@Table", SqlDbType.VarChar).Value = Table
    command.Connection.Open()
    Dim myDataAdapter As New SqlDataAdapter(command)
    Dim myDataSet As New DataSet
    Dim dtData As New DataTable
    myDataAdapter.Fill(myDataSet)
    Return myDataSet.Tables(0)
    command.Connection.Close()
End Function

SP

USE [AeriesAdmin]
GO
  
SET ANSI_NULLS ON
GO
  
SET QUOTED_IDENTIFIER ON
GO
  
CREATE PROCEDURE [dbo].[aa_task_table_permissions_by_object] 
  
@dbname sysname, 
@Grantee varchar(25),
@Table varchar(25)
    
AS 
BEGIN 
  
IF OBJECT_ID('tempdb..#tmpResults') IS NOT NULL 
DROP TABLE #tmpResults 
   
CREATE TABLE #tmpResults 
[Owner] NVARCHAR(MAX), 
[Object] NVARCHAR(MAX), 
[Grantee] NVARCHAR(MAX), 
[Grantor] NVARCHAR(MAX),  
[ProtectType] NVARCHAR(MAX), 
[Action] NVARCHAR(MAX), 
[Column] NVARCHAR(MAX
   
DECLARE @sp_executesql nvarchar(1024) 
   
SELECT @sp_executesql = @dbname + '.sys.sp_executesql' 
   
INSERT INTO #tmpResults 
[Owner], 
[Object], 
[Grantee], 
[Grantor], 
[ProtectType], 
[Action], 
[Column
EXECUTE @sp_ExecuteSQL N'sp_Helprotect' 
   
;with cte as (select Object, Grantee, Action,  
row_number() over (partition by Object, Grantee  ORDER BY Action) as Row from #TmpResults) 
   
select Object, Grantee, max(case when Action = 'Delete' then char(88) end) as [Delete],
  
max(case when Action = 'Insert' then char(88) end) as [Insert],
  
max(case when Action = 'Select' then char(88) end) as [Select],
  
max(case when Action = 'Update' then char(88) end) as [Update]
  
from #TmpResults
  
  
WHERE Grantee = @Grantee AND [Object] LIKE @Table
  
GROUP by Object, Grantee
  
END
  
GO

This all works great. However, I would like to extend this somewhat in that rather than just displaying the letter X in the row of the grid for each column, I would like to display a checkbox that is either checked or unched depending on the value in the cell. Is there a way to accomplish this, and if so, would it be possible to see an example?

Thank you in advance.










Rumen
Telerik team
 answered on 23 Jan 2020
4 answers
587 views

ASPX:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TelerikUpload.aspx.cs" Inherits="ImportMPV2_WebTest.TelerikUpload" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <div>
            <telerik:RadAsyncUpload
                AllowedFileExtensions="xlsx"
                EnableInlineProgress="true"
                ID="RadAsyncUpload1"
                MaxFileInputsCount="1"
                MultipleFileSelection="Disabled"
                OnFileUploaded="RadAsyncUpload1_FileUploaded"
                RenderMode="Lightweight"
                runat="server"
                Skin="Telerik"
                TargetDir="Uploads">
                <FileFilters>
                    <telerik:FileFilter Description="Excel Files(xlsx)" Extensions="xlsx" />
                </FileFilters>
            </telerik:RadAsyncUpload>
        </div>
        <br />
        <telerik:RadButton AutoPostBack="true" runat="server" Text="Import" Skin="Telerik" />
    </form>
 
    <pre>
<asp:label id="lblUploadResults" runat="server"></asp:label>
    </pre>
    <pre>
<asp:label id="lblSSISResults" runat="server"></asp:label>
    </pre>
 
</body>
</html>

 

Code behind:

protected void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
{
    UploadedFile uploadFile = e.File;
    string xlFilePath = Path.Combine(Server.MapPath(WebConfigurationManager.AppSettings["uploadDir"]), uploadFile.FileName);
 
    // Display upload results
    lblUploadResults.Text = "File Uploaded\n"
        + "File name: " + uploadFile.FileName + "\n"
        + "Content type: " + uploadFile.ContentType + "\n"
        + "Content length: " + uploadFile.ContentLength + "\n"
        + "Last modified date: " + uploadFile.LastModifiedDate + "\n";
 
    // Execute SSIS package
    SSISExecutor ssisExecutor = new SSISExecutor(
        xlFilePath
        , "Balance Import"
        , "gregorym"
        , false
        , WebConfigurationManager.AppSettings["logFilePath"]
        , WebConfigurationManager.ConnectionStrings["DatabasePEP1"].ConnectionString
        );
    ssisExecutor.Exec(out List<string> resultList);
 
    // Display SSIS results
    string s = "SSIS results:\n" + xlFilePath + ":\n\n";
    foreach (string result in resultList)
    {
        s += result + "\n";
    }
    lblSSISResults.Text = s;
}

 

Output:

File Uploaded
File name: ImportV2_Sample.xlsx
Content type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content length: 326210
Last modified date: 1/13/2020 4:47:40 PM
 
     
SSIS results:
C:\ImportMPV2_WebTest\Uploads\ImportV2_Sample.xlsx:
 
Error: File "C:\ImportMPV2_WebTest\Uploads\ImportV2_Sample.xlsx" not found

 

 

 

 

Matt
Top achievements
Rank 1
Veteran
 answered on 22 Jan 2020
3 answers
102 views

Hoping somebody can help me here.  I am following an example posted by Telerik on how to do this in this forum.  I am getting "" returned as the value for every column value (.Text).  All of my grid columns are GridtTmplateColumns and the column values are labels within the template.

 

How do accomplish this with GridTemplateColumns?  I have been struggling with this for the entire day.  Can I somehow use item.findcontrol here?

 

            Dim dtRecs As DataTable = New DataTable

            For Each col As GridColumn In rgbt.Columns
                If (col.ColumnType = "GridTemplateColumn") Then
                    Dim colstring As String
                    colstring = col.UniqueName
                    dtRecs.Columns.Add(colstring)
                End If
            Next

            For Each item As GridDataItem In rgbt.Items
                Dim newRow As DataRow = dtRecs.NewRow()
                For Each column As GridColumn In rgbt.Columns
                    If (column.ColumnType = "GridTemplateColumn") Then
                        newRow(column.UniqueName) = item.(column.UniqueName).Text    'RETURNS ""
                        dtRecs.Rows.Add(newRow)
                    End If
                Next
            Next

 

Thanks!

Acadia
Top achievements
Rank 1
Iron
 answered on 22 Jan 2020
1 answer
289 views

Hi,

 

I get an error [HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]

with:

    <telerik:radButton ButtonType="LinkButton" NavigateUrl="~/shop/shoppingcart.aspx" id="btn_nextsteptop" runat="server"><ContentTemplate>
        <asp:Literal ID="Literal1" Text="Jippeee" runat="server"></asp:Literal></ContentTemplate></telerik:radButton>

 

When I remove the tilde then the error is not occuring, so probably the relative path functionality is broken here?

 

Marc

Peter Milchev
Telerik team
 answered on 22 Jan 2020
1 answer
613 views

hi , i am using rad window to display content, i need to change color of the rad window from gray to white color

screenshot : http://prntscr.com/qr3k2i

Thanks

Rumen
Telerik team
 answered on 22 Jan 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?