Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
1.2K+ views
Hi all:

I am working with this example:

http://demos.telerik.com/aspnet-ajax/upload/examples/async/webmail/defaultcs.aspx?product=asyncupload

However I do not understand how to read the file data from the uploaded files. I need to read the files into a byte array. Here is the code:

PopulateUploadedFilesList();
if (UploadedFiles != null)
{
  AttachmentRepeater.DataSource = UploadedFiles;
  AttachmentRepeater.DataBind();
  for (int i = 0; i<UploadedFiles.Count; i++)
  {
       #region get file content
       // Open a file and read the contents into a byte array.
       FileStream stream = File.OpenRead(UploadedFiles[i].FileName);
       byte[] byteData = new byte[stream.Length];
       stream.Read(byteData, 0, byteData.Length);
       stream.Close();
       // Encode the data using base64.
       string encodedData = System.Convert.ToBase64String(byteData);
     }
  }

Any and all help is greatly appreciated.

John.
Vessy
Telerik team
 answered on 23 Mar 2021
1 answer
118 views

Dear Sirs or Madams,

just for your information: On your website "https://demos.telerik.com/responsive-web-design-aspnet/samples/adaptive/media-player.aspx", the video-source is currently not available.

Kind Regards.

Vessy
Telerik team
 answered on 22 Mar 2021
9 answers
253 views

Hello, I have two grids on the same page in batch edit mode. When I submit a page via javascript code the second grid has command type of "Update" instead of "Insert". Please help!

<div class="grid__col grid__col--1-of-2">
                <p>Prescriptions</p>
                <telerik:RadGrid ID="gridPrescriptions" runat="server" AutoGenerateColumns="false"
                    AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowSorting="True" AllowPaging="True"
                    OnNeedDataSource="gridPrescriptions_NeedDataSource" Width="100%" DataKeyNames="EscalationCaseRxId"
                    OnBatchEditCommand="gridPrescriptions_BatchEditCommand">
                    <MasterTableView CommandItemDisplay="Top" EditMode="Batch">
                        <BatchEditingSettings EditType="Row" />
                        <CommandItemSettings ShowSaveChangesButton="false" ShowRefreshButton="false" ShowCancelChangesButton="false" />
                        <Columns>
                            <telerik:GridBoundColumn DataField="RxNumber" HeaderText="Prescription Number *" UniqueName="RxNumber" MaxLength="50" HeaderStyle-Width="300">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" Text="*This field is required" runat="server">
                                    </RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridDateTimeColumn DataField="DateOfService" HeaderText="Date of Service *" UniqueName="DateOfService" HeaderStyle-Width="400" DataFormatString="{0:MM/dd/yyyy}">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" Text="*This field is required" runat="server">
                                    </RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridDateTimeColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </div>
 
            <div class="grid__col grid__col--1-of-2">
                <p>Benefit Verification</p>
                <telerik:RadGrid ID="gridBenefitVerification" runat="server" AutoGenerateColumns="false"
                    AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowSorting="false" AllowPaging="True"
                    OnNeedDataSource="gridBenefitVerification_NeedDataSource" Width="100%" DataKeyNames="EscalationCaseBvId" OnBatchEditCommand="gridBenefitVerification_BatchEditCommand">
                    <MasterTableView CommandItemDisplay="Top" EditMode="Batch">
                        <BatchEditingSettings EditType="Row" />
                        <CommandItemSettings ShowSaveChangesButton="false" ShowRefreshButton="false" ShowCancelChangesButton="false" />
                        <Columns>
                            <telerik:GridDateTimeColumn DataField="DateVerified" HeaderText="Date Benefit Verified*" UniqueName="DateVerified" HeaderStyle-Width="400" DataFormatString="{0:MM/dd/yyyy}">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                    <RequiredFieldValidator ForeColor="Red" Text="*This field is required" runat="server">
                                    </RequiredFieldValidator>
                                </ColumnValidationSettings>
                            </telerik:GridDateTimeColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </div>
 
function saveChanges() {
                if (Page_IsValid) {
                    <%--var grid = $find("<%= gridPrescriptions.ClientID %>");
                    if (grid.get_masterTableView().get_dataItems().length > 0) {
                        grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());
                    }
                    else {
                        var label = document.getElementById("<%= lblMessage.ClientID%>");
                        label.innerText = "Please add at least one prescription.";
                        label.style.color = "red";
                        label.style.display = "";
                        document.body.scrollTop = document.documentElement.scrollTop = 0;
                    }--%>
 
                    var gridRx = $find("<%= gridPrescriptions.ClientID %>");
                    var masterTableRx = gridRx.get_masterTableView();
 
                    if (masterTableRx.get_dataItems().length > 0) {
 
                        var gridBv = $find("<%= gridBenefitVerification.ClientID %>");
                        var masterTableBv = gridBv.get_masterTableView();
                        var batchEditManager = gridBv.get_batchEditingManager();
                        var tables = [];
 
                        //var changes1 = batchEditManager._changes;
                        //var changes2 = gridRx.get_batchEditingManager()._changes;
 
                        tables.push(masterTableRx);
                        tables.push(masterTableBv);
 
                        batchEditManager.saveTableChanges(tables);
                    }
                    else
                    {
                        var label = document.getElementById("<%= lblMessage.ClientID%>");
                        label.innerText = "Please add at least one prescription.";
                        label.style.color = "red";
                        label.style.display = "";
                        document.body.scrollTop = document.documentElement.scrollTop = 0;
                    }
                }
            }

 

 

Attila Antal
Telerik team
 answered on 22 Mar 2021
10 answers
862 views

Hi,

I am increasing the font size for RadRadioButtonList, but the radio circle remain small. see attached image.

Is there a way to increase the size of the radio button?

Regards,

Omar

Omar
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 19 Mar 2021
1 answer
113 views

I have a RadGrid on my page that I use as a selector, and via it's SelectedIndexChanged I wanna set some header filter on another grid.

Each time the selection is changed in the first RadGrid (rgPendingRequests) I want to adjust the header filter of rgResponsables and filter the result. The user must then be able to change the header filter as he wish, in case the filter returns nothing.

This is the grid I wanna apply the header filter to

<telerik:RadGrid
    ID="rgResponsables"
    runat="server"
    Width="100%"
    Height="220px"
    AutoGenerateColumns="False"
    EnableViewState="true"
    AllowFilteringByColumn="True"
    AllowSorting="True"
    CssClass="gridPartageResponsables"
    EnableLinqExpressions="false"
>
    <GroupingSettings CaseSensitive="false"></GroupingSettings>
    <ClientSettings EnableRowHoverStyle="true" Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="true" Scrolling-UseStaticHeaders="true" />
    <MasterTableView
        DataKeyNames="ResponsableID"  
        AllowFilteringByColumn="True"
    >
        <Columns>
            <telerik:GridBoundColumn DataField="Prenom" Visible="true" HeaderStyle-Font-Bold="true" HeaderText="Prénom" UniqueName="Prenom" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
            <telerik:GridBoundColumn DataField="Nom" Visible="true" HeaderStyle-Font-Bold="true" HeaderText="Nom" UniqueName="Nom" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
            <telerik:GridBoundColumn DataField="Courriel" Visible="true" HeaderStyle-Width="250px" HeaderStyle-Font-Bold="true" HeaderText="Courriel" UniqueName="Courriel" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
            <telerik:GridBoundColumn DataField="Telephone" Visible="true" HeaderStyle-Width="120px" HeaderStyle-Font-Bold="true" HeaderText="Téléphone" UniqueName="Telephone" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Here is my code Behind:

Protected Sub rgPendingRequests_SelectedIndexChanged(sender As Object, e As EventArgs) _
Handles rgPendingRequests.SelectedIndexChanged
 
    Dim PrenomCol = rgResponsables.MasterTableView.GetColumnSafe("Prenom")
    PrenomCol.CurrentFilterFunction = GridKnownFunction.Contains
    PrenomCol.CurrentFilterValue = rgPendingRequests.SelectedValues("FirstName")
 
    Dim NomCol = rgResponsables.MasterTableView.GetColumnSafe("Nom")
    NomCol.CurrentFilterFunction = GridKnownFunction.Contains
    NomCol.CurrentFilterValue = rgPendingRequests.SelectedValues("LastName")
 
    rgResponsables.Rebind()
         
End Sub

But even though the values appear in the header filter, the table is not filtered until I go to a header filter field and press enter...

I've tried everything I can think of, and could not make it work...

I could really use some pointer on what I'm doing wrong...

Doncho
Telerik team
 answered on 19 Mar 2021
1 answer
105 views

Hello,

we have a grid with client databinding. Backend is a WCF web service.

The requirement is, the client side column filter setting(user has a filter text in the column Title) shall be restored if the page has been reloaded(for example after adding a new item).

But the Contains-filter doesn't work with part-match. It works only if the filter-text equals the Title(full match). It is the same with StartWith-filter.

What wasI wrong?

The Telerik.Web.UI assembly version is 2015.2.826.45

Please help. Thanks.

function applyFilter() {
    var grid = $find("<%= RadGrid_PublishedDocuments.ClientID %>");
    var tableView = grid.get_masterTableView();
 
    var column = tableView.getColumnByUniqueName("Title");
    column.set_filterFunction("Contains");
    tableView.filter("Title", "dcr", Telerik.Web.UI.GridFilterFunction.Contains, true);
    tableView.rebind();
}

 

 

Doncho
Telerik team
 answered on 19 Mar 2021
4 answers
309 views
I need an example when a user logs in. he/she will see their information.

I appreciate some examples.

Rumen
Telerik team
 answered on 18 Mar 2021
1 answer
124 views

Hi,

 

Is the attached app from the Telerik website a raddrawer?

Could you reveal the code for this?

 

Marc

Rumen
Telerik team
 answered on 18 Mar 2021
24 answers
805 views
Hi,

It is common practice to do something such as this:

<link rel="stylesheet" type="text/css" href="../Content/Dashboard/Dashboard.css?t=<%= DateTime.Now.Ticks %>" />

This is for development purposes, and would be converted to something like ?v=[Version Number] for releases. This is to force browsers to reload CSS instead of using cached versions.

If I attempt to use the same syntax inside of RadStyleSheetManager I am told I am using illegal characters. Does Telerik's control support something like this?

Thanks

Sean
Jackie
Top achievements
Rank 1
 answered on 17 Mar 2021
4 answers
3.9K+ views
I can't get the filters for 'equal to' working on date time column in rad grid. As far as I can tell this has something to do with the times on the dates. I have seen many posts about this here with no answer so I guess I don't really expect help, but just throwing my voice in with everyone else saying your filters don't work right for date time columns. Period.
Rumen
Telerik team
 answered on 17 Mar 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?