Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
106 views

Hello-

    I have a radGrid which i'd like to append a csv to the rows in the radGrid. How would I go about doing this? I have an upload function in my code but when it run it replaces all data in grid with data from the chosen CSV.

 

ASPX.VB

Imports System.Data
Imports Telerik.Web.UI
Imports System.IO
Imports System.Data.SqlClient
Imports System.Configuration

Partial Class JPTest
    Inherits System.Web.UI.Page

    Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            LoadAtrributeDropDown()
        End If
    End Sub
    Private Sub LoadAtrributeDropDown()
        'AttributeTypeBox.DataSource = GetDataTable("SELECT TOP 10000 lkct.CategoryLabel, lkct.CategoryID  FROM dbo.LkupCategories lkct ORDER BY lkct.CategoryLabel")

        Dim ConnString As [String] = ConfigurationManager.ConnectionStrings("eCommerceClassification").ConnectionString
        Dim adapt As New SqlDataAdapter()
        Dim CategoryDataTable As New DataTable()
        Using conn As New SqlConnection(ConnString)

            adapt.SelectCommand = New SqlCommand("SELECT TOP 10000 lkct.CategoryLabel, lkct.CategoryID  FROM dbo.LkupCategories lkct ORDER BY lkct.CategoryLabel", conn)
            adapt.Fill(CategoryDataTable)
        End Using
        AttributeTypeBox.DataTextField = "CategoryLabel"
        AttributeTypeBox.DataValueField = "CategoryID"
        AttributeTypeBox.DataSource = CategoryDataTable
        AttributeTypeBox.DataBind()

        AttributeTypeBox.Items.Insert(0, "----SELECT----")

    End Sub


    'Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles ReceiptGrid.NeedDataSource

    'End Sub

    Public Function GetDataTable(ByVal query As String) As DataTable
        Dim ConnString As [String] = ConfigurationManager.ConnectionStrings("eCommerceClassification").ConnectionString
        Dim adapter As New SqlDataAdapter()
        Dim myDataTable As New DataTable()
        Using conn As New SqlConnection(ConnString)
            adapter.SelectCommand = New SqlCommand(query, conn)
            adapter.Fill(myDataTable)
        End Using
        Return myDataTable
    End Function
   
    Protected Sub AttributeTypeBox_SelectedIndexChanged(sender As Object, e As RadComboBoxSelectedIndexChangedEventArgs)
        ReceiptGrid.DataSource = GetDataTable("SELECT TOP 5000 ah.CategoryID, lkct.CategoryLabel, lka.AttributeLabel, lkat.AttributeTypeLabel FROM dbo.AttributeHierarchy ah INNER JOIN dbo.LkupCategories lkct WITH (NOLOCK) ON ah.CategoryID = lkct.CategoryID INNER JOIN dbo.LkupAttributes lka WITH (NOLOCK) ON ah.AttributeTypeID = lka.AttributeTypeID INNER JOIN dbo.LkupAttributeTypes lkat WITH (NOLOCK) ON lkat.AttributeTypeID = ah.AttributeTypeID WHERE lkct.CategoryID = '" & AttributeTypeBox.SelectedItem.Value & "' ORDER BY ah.DateActivated DESC")
        ReceiptGrid.DataBind()
    End Sub

    Public Function Upload(sender As Object, e As EventArgs) As DataTable
        'Upload and Import TabDelimited CSV
        Dim csvPath As String = Server.MapPath("~/File") + Path.GetFileName(FileUpload1.PostedFile.FileName)
        FileUpload1.SaveAs(csvPath)

        Dim dt As New DataTable()
        dt.Columns.AddRange(New DataColumn(3) {New DataColumn("CategoryID", GetType(String)), New DataColumn("CategoryLabel", GetType(String)), New DataColumn("AttributeLabel", GetType(String)), New DataColumn("AttributeTypeLabel", GetType(String))})

        Dim csvData As String = File.ReadAllText(csvPath)
        For Each row As String In csvData.Split(Environment.NewLine) 'How to split csv?'
            If Not String.IsNullOrEmpty(row) Then
                dt.Rows.Add()
                Dim i As Integer = 0
                For Each cell As String In row.Split(","c)
                    dt.Rows(dt.Rows.Count - 1)(i) = cell
                    i += 1
                Next
            End If
        Next
        ReceiptGrid.DataSource = dt
        ReceiptGrid.DataBind()
    End Function
End Class

 

 

 

 

Marin Bratanov
Telerik team
 answered on 24 Oct 2016
1 answer
79 views

Hi,

Have created a RadWindow and gave the property autosize=true, it works fine IE with correct height and width based on the contents, but in Chrome width and height are not according to content.

Marin Bratanov
Telerik team
 answered on 24 Oct 2016
1 answer
167 views

Is it possible to have another wizard (child wizard) within one of the wizard steps?  I have tried, it seems doe not work... The Next button for the nested wizard acts like the parent wizard next button.  Any one has any idea if this can be done ?

 

Thanks!

Bozhidar
Telerik team
 answered on 24 Oct 2016
3 answers
195 views

We have controls within a RadPageLayout control that we would like to add into RadAjaxManager individually but the UI in VS does not show any of the controls within the RadPageLayout control.

So the only option seems to be a full refresh of the whole RadPageLayout control. Is there any way to manage the controls within the RadPageLayout at all?

Konstantin Dikov
Telerik team
 answered on 24 Oct 2016
3 answers
517 views

Hi,

In my grid i need to set enable= false for GridEditCommandColumn,GridButtonColumn's.Here is my source code:

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditButton"
                                 HeaderStyle-HorizontalAlign="Left" HeaderText="Edit" 
                                 ItemStyle-HorizontalAlign="Left">
                                 <HeaderStyle HorizontalAlign="Left" />
                                 <ItemStyle HorizontalAlign="Left" />
                             </telerik:GridEditCommandColumn>
  
                             <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" UniqueName="DeleteButton"
                                 ConfirmDialogHeight="100px" ConfirmDialogType="RadWindow" HeaderText="Delete"
                                 ConfirmDialogWidth="220px" 
                                 ConfirmText="Are you sure you want to delete this Indent Item?" ConfirmTitle="Delete" 
                                 HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="NotSet" 
                                 ItemStyle-HorizontalAlign="Left">
                                 <HeaderStyle HorizontalAlign="Left" />
                                 <ItemStyle HorizontalAlign="Left" />
                             </telerik:GridButtonColumn>

I am using below code under PreRender event for the above requirement as below:
protected void gvItems_PreRender(object sender, EventArgs e)
   {
       foreach (GridDataItem item in gvItems.MasterTableView.GetItems(GridItemType.Item))
                {
                   ImageButton btn1 = (ImageButton)item.FindControl("EditButton");//accessing the Button by its name
                   btn1.Enabled = false;                    
                }
   }

Even though it's not working...

Can any one help me...

Thanks in advance...
Anto
Top achievements
Rank 1
 answered on 22 Oct 2016
3 answers
519 views

I have a RadCheckBox on an ASP.Net page with VB.net as the code-behind.

The text for the RadCheckBox is kind of long so needs to be wrapped to the next line or put a carriage-return line-feed in the Text.

I have tried putting <br /> in the Text but that did not work.

I have tried putting the following CSS:

html RadButton.rbCheckBox .rbText {
    word-wrap: normal;
}

 

But that did not work either.

Attached is a screenshot showing the RadCheckBox circled in Red.

Please help!

Keith
Top achievements
Rank 1
 answered on 21 Oct 2016
8 answers
661 views
Hi,

I have Rad Grid which has command button in command template
<telerik:RadGrid ID="rgUsers" AutoGenerateColumns="false" runat="server" OnNeedDataSource="OnNeedDataSource">
           <ClientSettings>
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>
           <MasterTableView TableLayout="Fixed" CommandItemDisplay="Top" EditMode="InPlace"
               InsertItemDisplay="Bottom" AutoGenerateColumns="false">
               <CommandItemTemplate>
                   <asp:LinkButton ID="btnAddNew" runat="server" CommandName="InitInsert" Text="New"
                       Visible='<%# rgUsers.EditIndexes.Count == 0 && !rgUsers.MasterTableView.IsItemInserted %>' />
                     
                   <asp:Button ID="btnInsert" runat="server" CommandName="PerformInsert" Text="Insert" />
                     
                   <asp:Button ID="btnEditSelected" runat="server" CommandName="EditSelected" Text="Edit" />
               </CommandItemTemplate>
               <Columns>
                   <telerik:GridTemplateColumn HeaderText="UserName" UniqueName="UserName" SortExpression="UserName"
                       ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Center">
                       <ItemTemplate>
                           <asp:Label ID="lblUsername" runat="server" Text='<%#Eval("UserName")%>' />
                       </ItemTemplate>
                       <EditItemTemplate>
                           <telerik:RadTextBox ID="txtUsername" runat="server" Text='<%#Eval("UserName")%>'>
                           </telerik:RadTextBox>
                       </EditItemTemplate>
                   </telerik:GridTemplateColumn>                 
               </Columns>
           </MasterTableView>
       </telerik:RadGrid>
to add new row,  which is working perfectly .
But it is server side method.

I want that client side ,and new row should be inline and in edit mode.

Please suggest for the same.

Thanks 





Jonathan
Top achievements
Rank 1
 answered on 21 Oct 2016
3 answers
145 views
Hey guys, having some issues, been racking my brain...

I am trying to provide list results in a radgrid.

my code so far is:

dt.Columns.Add("chk")
dt.Columns.Add("Profile Image")
dt.Columns.Add("Name")
dt.Columns.Add("Info1")
dt.Columns.Add("Info2")
dt.Columns.Add("Score")
dt.Columns.Add("Actions")
 
 
 
dt.Rows.Add(CheckBox, Image, "#Name#", "#Info#", "#Info2#", "#Score#", "##Actions##")
 
RadGrid1.DataSource = dt
RadGrid1.Rebind()

I am having issues setting checkbox, and image. I assume if I can get an example of 1, I can figure out the other.

I was also going to be adding buttons into the 'Actions' column as well.


Thanks in advance!
Jonathan
Top achievements
Rank 1
 answered on 21 Oct 2016
1 answer
154 views

I have a need to use a RadWindow from a HyperLink in both the level 1 columns and the DetailTables. 

The RadGrid data is populated via OnNeedDataSource() as the data is extracted from a context.

The DetailTables data is populated via OnDetailTableDataBind().

When I used an OnItemCreated() to enable me to change the href and onclick attributes of the asp:HyperLinks, I lost the data in the RadGrid and was not able to select anything.  I realize it is because the data has been changed so this option is not available to me, though the RadWindow was working nicely.

Currently I am using GridHyperLinkColumns but am unable to use a RadWindow with these.

Any suggestions of how to make it work?

Eyup
Telerik team
 answered on 21 Oct 2016
6 answers
102 views

The text in design tab for the radeditor shows single space but in HTML tab there are two spaces.  I'm assuming the radeditor is compensating for this in the design tab?  Is there anything we can do about it?  Our users don't realize there is an extra space that shouldn't be there because they don't see it.

 

For example, the text "administration to the bloodstream" does not appear to have extra spaces between 'administration' and 'to' when viewed in the design tab, bit when viewed in the html tab it appears as like this... "administration  to the bloodstream"

Thanks
Rumen
Telerik team
 answered on 21 Oct 2016
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
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
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?