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

Hi,

How can I set the filename (arguments) that gets sent to the client callback from the ImageEditor?

i.e. from :  $find('<%= ImageEditor1.ClientID %>').open('ImageEditor', args, callbackFunction);

On the server side, i couldnt find a SetFileName method...

I tried returning the filename from the StoreBitmap method (just for fun), but it didnt work.

Can you guys please help me on this? thanks in advance.

Dobromir
Telerik team
 answered on 29 Sep 2010
3 answers
100 views
Hi

What I am try doing might not be possible or sensible.

I am building a dynamic grid page to edit / insert/ delete data from an unknown tablename with an unknown number of fields (except at render time).

I know that all of my field are one of two types, either a numeric or a string which is often entered multiple times.

I build the columns / insert / edit SQL dynamically and I have the basics working.
I want my "string" columns to appear in the insert / edit (inline) form as a combo box to allow them to type customer text or select from a list of existing items (populated as a distinct list of all previous data entered).

Problem 1: I have changed the BoundColumn to a griddropdown, but now on view mode of the grid the field values are empty (were fine with boundcolumn) but the combo appears on clicking insert.

Problem 2: Can I allow customtext in a griddropdowncolumn? if so how do I do this.

Problem 3: I can't work out how to populate the combo with the preset values. Is it possible to bind to a datareader in code or is my approach wrong?

Below is my code running in page_load. "Case 6" is the problem area. case 6 means that the column is a string and should use the dropdown.

Thanks in advance.

Johnathan

' build grid
Dim FieldListList As SqlDataReader = kpiSQL.getReader("select * from dbo.kpi_QuantityColumn where tableid=" & tableid.ToString)
While FieldListList.Read
    Select Case FieldListList("fielddataType")
        Case 6 ' is a string column
            Dim boundColumn As GridDropDownColumn
            boundColumn = New GridDropDownColumn()
            boundColumn.EmptyListItemText = "--type or choose--"
            ' allowcustomtext???
            boundColumn.UniqueName = FieldListList("FieldName")
            boundColumn.DataField = FieldListList("FieldName")
            boundColumn.DropDownControlType = GridDropDownColumnControlType.RadComboBox
            boundColumn.HeaderText = FieldListList("FieldName")
            boundColumn.HeaderStyle.Wrap = False
            Dim presetReader As SqlDataReader = kpiSQL.getReader("SELECT DISTINCT " & FieldListList("FieldName") & " FROM " & thisTable.dbTableName)
            ' ???? how do I bind the combo to presetReader? 
            RadGrid1.MasterTableView.Columns.Add(boundColumn)
        
        Case Else ' is a numeric column
            Dim boundColumn As GridNumericColumn
            boundColumn = New GridNumericColumn()
            RadGrid1.MasterTableView.Columns.Add(boundColumn)
            boundColumn.UniqueName = FieldListList("FieldName")
            boundColumn.DataField = FieldListList("FieldName")
            Dim prefix As String = ""
            If Not IsDBNull(FieldListList("prefix")) And FieldListList("FieldName") <> "" Then
                prefix = " (" & FieldListList("prefix") & ")"
            End If
            boundColumn.HeaderText = FieldListList("FieldName") + prefix
            boundColumn.HeaderStyle.Wrap = False
            boundColumn.DataFormatString = "{0:N" & FieldListList("NumberOfDps") & "}"
    End Select
End While
Mira
Telerik team
 answered on 29 Sep 2010
1 answer
73 views
Hi,

I have a grid with dynamic number of columns.
the grid can have anything between 3 to 20 columns for export.

The issue that I am having is if i export the grid with a fixed pagewidth the export does not look good.
In portrait mode the grid cuts off the columns. In lanscape mode if there's a fixed width then if the number of columns are less there's a big white space in the end.

Can the export size dynamicallt based on the number of columns?
Daniel
Telerik team
 answered on 29 Sep 2010
7 answers
201 views
Hello, guys.
I'm thinking about the one thing.
During development of our aspx page it acquires controls which must be updated in this or that situation. And there are cases when one so to say "central" control ajaxifies many other controls. But those controls haven't to be updated each time the "central" control changes it's properties. I mean that some of them have to be updated in this particular case while others should be updated in other cases.
What we have with AjaxManager is that we setting those "dependant" controls as update targets and "central" control updates them all each time it changes itself. As some of those controls could be very complex themselves we're wasting noticable amount of time for nothing but redrawing of what is already drew inside the browser's window.
So I wonder if there any way to make AjaxManager more flexible and prevent updating some controls when situation does not suppose that those "dependable" controls will be changed in any manner?

With respect, Sergey.
Veli
Telerik team
 answered on 29 Sep 2010
1 answer
178 views
Over the last week I have researched ways to use client-side binding with the radGrid.

I understand that I can use declarative binding and write a single pagemethod/web service that will bring back both the data and the count and the declaritive code will handle binding both sets of data.  Is there a way to do the same when calling a page method  or web service directly from javascript?

I am aware of the methods for binding the grid and setting the virtualItemCount, but I believe I would have to have to parse the json result set to get the count information as these are 2 seperate functions.  Is there a way to pass the json result set to the grid and it knowing how to bind both the data and the count information?

I ask this because I'd like to call a single WCF service using only jQuery.  I'd like to bind the resulting data + count to the grid.  Am I asking for too much?

thanks,
Iana Tsolova
Telerik team
 answered on 29 Sep 2010
1 answer
218 views
Hi,

I'm using a custom content provider for the FileExplorer component, and I  want to conditionally change the folder and file icons for the _grid_ depending on the "state" of that particular folder or file.

For example, say I've just selected a folder in the TreeView, and the grid is now displaying the contents of that selected folder. The grid might now have the following content: Folder1, Folder2, fileA, fileB

At server side, I know that e.g. Folder2 and fileB are "special" in some way, and I want to mark the client markup that is generated for these two items with a "special css class". The idea is that this css class will be used to override the standard icons used.

Is there a way of doing this? (Preferrably server side, since there I've already got all information and infrastructure ready).

My first idea was to traverse the fileExplorer.Grid.Items in Page_PreRender looking for GridDataItems that met a special criteria. However, I can't seem to find find any property in the GridDataItems that maps to the corresponding DirectoryItems that backs the FileExplorer. If I could use a value in the GridDataItem to find out which DirectoryItem it represents, i.e. the DirectoryItems path property, I could then set a css class based on that. (This strategy is what I'm currently using for the icon override in the TreeView, since the RadTreeNode.Value is the same as the DirectoryItem.Name)

Another idea was to add a css class directly on the DirectoryItem at the time of Provider.ResolveRootDirectoryAsTree(..) running. But I haven't found a way of doing it in that manner.

Do you have any suggestions on how to accomplish what I'm looking for?

Thank you in advance,
Regards Andreas
Fiko
Telerik team
 answered on 29 Sep 2010
5 answers
244 views
I added a radcombobox to my page and set up a datasource of linqtosql.  When I ran it and clicked on the combobox, the dropdown appeared significantly below the combobox.  See the attached screen print.  Here is the markup excerpt from my aspx page :
<td>
    <telerik:RadComboBox ID="rcbExamLocation" Runat="server"
        DataSourceID="LinqDataSource1" DataTextField="LocCity"
        DataValueField="LocationID" Width="250px" Skin="WebBlue" OffsetY="0" ExpandAnimation-Type="Linear" ExpandAnimation-Duration="150">
    </telerik:RadComboBox>
    <asp:LinqDataSource ID="LinqDataSource1" runat="server"
        ContextTypeName="SPPExamRegistrationAlphaDataContext"
        OrderBy="LocCity, LocAddress"
        Select="new (LocCity, LocAddress, LocCounty, LocationID)"
        TableName="viewExamLocations">
    </asp:LinqDataSource>
</td>



I have discovered I can adjust this with the OffsetX and Y properties but what is wrong that caused this in the first place?  Surely this isn't the normal position for the control is it?

I am running VS 2008 SP1 on Windows XP SP3 with the 2009.2.826 version of RadControls for ASP.NET AJAX.  Does anybody have a solution other than modifying the OffsetX and Y properties until the dropdown moves back up vicinity of the combobox?

Thanks,
Alex

Yana
Telerik team
 answered on 29 Sep 2010
4 answers
70 views

First, I'm using the most recent version of the RadAJAX controls.

I've been trying to set, in the codebehind, the filter control tooltip to the text equivalent of the CurrentFilterFunction that's defined in the markup.  I finally came up with a solution but my tooltips were shifted by two columns.  It's like there are two "hidden" GridFilterItem cells in that row in the grid.

Here is the markup:

 

 

 

 


<telerik:RadGrid ID="radgrdMyPrograms" runat="server" Width="100%"  DataSourceID="ldsProgramsAllByUserName" EnableLinqExpressions="false"
    EnableEmbeddedSkins="false" Skin="DMCpro" ShowStatusBar="true"
    AutoGenerateColumns="false" AllowFilteringByColumn="true" AllowPaging="true" AllowSorting="true" PageSize="20" >
    <ClientSettings EnableRowHoverStyle="true" Selecting-AllowRowSelect="true" Scrolling-AllowScroll="true" Scrolling-ScrollHeight="600px" Scrolling-UseStaticHeaders="true" />
    <MasterTableView TableLayout="Fixed" DataKeyNames="ProgramID,ProgramName,ClientId,Client" >
        <HeaderStyle Font-Size="Small" Font-Bold="true" />
        <ItemStyle Font-Size="Small" Wrap="false" />
        <AlternatingItemStyle Font-Size="Small" Wrap="false" />
        <Columns>
            <telerik:GridHyperLinkColumn HeaderText="Program #" DataTextField="ProgramID" SortExpression="ProgramID" UniqueName="ProgramID"
                HeaderStyle-Width="80px" HeaderStyle-HorizontalAlign="Left"
                AllowFiltering="false" />
            <telerik:GridBoundColumn HeaderText="Program" DataField="ProgramName" SortExpression="ProgramName"
                HeaderStyle-Width="150px" HeaderStyle-HorizontalAlign="Left"
                CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false" FilterControlWidth="150px" />
            <telerik:GridBoundColumn HeaderText="AE" DataField="AEName" SortExpression="AEName"
                HeaderStyle-Width="35px" HeaderStyle-HorizontalAlign="Left"
                AllowFiltering="false" />
            <telerik:GridBoundColumn HeaderText="Start&nbsp;Date" DataField="StartDate" SortExpression="StartDate" 
                HeaderStyle-Width="65px" HeaderStyle-HorizontalAlign="Left" DataFormatString="{0:MM/dd/yyyy}" DataType="System.DateTime"
                CurrentFilterFunction="GreaterThanOrEqualTo" AutoPostBackOnFilter="true" ShowFilterIcon="false" FilterControlWidth="60px" />
            <telerik:GridBoundColumn HeaderText="End Date" DataField="EndDate" SortExpression="EndDate"
                HeaderStyle-Width="65px" HeaderStyle-HorizontalAlign="Left" DataFormatString="{0:MM/dd/yyyy}" DataType="System.DateTime"
                CurrentFilterFunction="LessThanOrEqualTo" AutoPostBackOnFilter="true" ShowFilterIcon="false" FilterControlWidth="60px" />
            <telerik:GridBoundColumn HeaderText="Status" DataField="Status" SortExpression="Status"
                HeaderStyle-Width="92px" HeaderStyle-HorizontalAlign="Left"
                CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" ShowFilterIcon="false" FilterControlWidth="90px" />
            <telerik:GridBoundColumn HeaderText="Revenue" DataField="Revenue" SortExpression="Revenue"
                HeaderStyle-Width="100px" HeaderStyle-HorizontalAlign="Left" DataFormatString="{0:C}" ItemStyle-HorizontalAlign="Right"
                CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" ShowFilterIcon="false" />
            <telerik:GridHyperLinkColumn HeaderText="Client" DataTextField="Client" SortExpression="Client" UniqueName="Client"
                HeaderStyle-Width="170px"
                CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false" FilterControlWidth="170px" />
            <telerik:GridBoundColumn HeaderText="Market" DataField="Market" SortExpression="Market"
                HeaderStyle-Width="90px" HeaderStyle-HorizontalAlign="Left"
                CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" ShowFilterIcon="false" />
            <telerik:GridBoundColumn HeaderText="Bus. Source" DataField="BusinessSource" SortExpression="BusinessSource"
                HeaderStyle-Width="100px" HeaderStyle-HorizontalAlign="Left"
                CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" ShowFilterIcon="false" />
            <telerik:GridBoundColumn HeaderText="Pax" DataField="Guests" SortExpression="Guests"
                HeaderStyle-Width="45px" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Right"
                CurrentFilterFunction="EqualTo" AutoPostBackOnFilter="true" AllowFiltering="false" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>


And here is the codebehind:

 

 

 

 

 

 

    Private Sub radgrdMyPrograms_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles radgrdMyPrograms.ItemDataBound
        If (TypeOf e.Item Is GridDataItem) Then
            Dim gdi As GridDataItem = DirectCast(e.Item, GridDataItem)

            Dim hlc As HyperLink = DirectCast(gdi.Item("ProgramID").Controls(0), HyperLink)
            hlc.NavigateUrl = "~/Programs/Programs.aspx?PNO=" + radgrdMyPrograms.MasterTableView.DataKeyValues(e.Item.ItemIndex)("ProgramID").ToString + "&PName=" + Replace(Server.UrlEncode(radgrdMyPrograms.MasterTableView.DataKeyValues(e.Item.ItemIndex)("ProgramName")), "'", "")
            hlc.CssClass = "info"

            Dim hlc2 As HyperLink = DirectCast(gdi.Item("Client").Controls(0), HyperLink)
            hlc2.NavigateUrl = "~/Crm/Clients.aspx?ClientId=" + radgrdMyPrograms.MasterTableView.DataKeyValues(e.Item.ItemIndex)("ClientId").ToString + "&ClientName=" + Replace(Server.UrlEncode(radgrdMyPrograms.MasterTableView.DataKeyValues(e.Item.ItemIndex)("Client")), "'", "")
            hlc2.CssClass = "info"
        ElseIf (TypeOf e.Item Is GridFilteringItem) Then
            Dim fi As GridFilteringItem = DirectCast(e.Item, GridFilteringItem)

            For i = 0 To radgrdMyPrograms.Columns.Count - 1
                fi.Cells(i + 2).ToolTip = radgrdMyPrograms.Columns(i).CurrentFilterFunction.ToString
            Next
        End If
    End Sub

 

 

 

 



Why do I have to have the (i + 2) in that last statement??

Jerry

 

Jerry T.
Top achievements
Rank 1
 answered on 29 Sep 2010
1 answer
409 views
How do I update a column in radGrid using JavaScript client side?

I can find the row that I am wanting to update the column in but can't figure out how to update the column itself. Changing the text value of the label control does not persist after the rebind.

I am reading the data from a SQL table but the data is never written back to the SQL server.

           
function updateTable() {
           // "txt" here is the args sent to the "onReceive" function
   // set txt value for testing purposes
           var txt = 'HB2573';
           // get the reference to the RAD grid
           var grid = $find("<%=RadGrid1.ClientID %>");
           // get the underlying table view
           var MasterTable = grid.get_masterTableView();
           // get the underlying data source
           var items = MasterTable.get_dataItems();
           // get the # of rows
           var length = MasterTable.get_dataItems().length;
 
           for (var i = 0; i < length; i++) {
               // get the record
               var record = MasterTable.get_dataItems()[i];
                
               var keyValue = record.getDataKeyValue("fa_MeasureValue")
               //alert(keyValue);
               if (keyValue == txt) {
                   var CM = record.findElement("lblCurrentMeasure"); //access the Label control
                   //alert(CM.innerText);
                   CM.innerText = "1"; // assigning value to label control
                   //alert(CM.innerText);
               } else {
                   var CM = record.findElement("lblCurrentMeasure"); //access the Label control
                   CM.innerText = "0"; // assigning value to label control
               }
           }
 
           // and rebind it to the changed data
           MasterTable.rebind();
 
       }

   
Ivaylo
Top achievements
Rank 1
 answered on 29 Sep 2010
2 answers
95 views
In RadGrid Column, How can I set Filter DataField for a column instead of using the default "DataField" attribute.
I can see a GetFilterDataField() method but not SetFilterDataField(). Is there a way I can achieve this.

Thank you.

Raju S
Mira
Telerik team
 answered on 29 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?