Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
221 views
I'm getting close on this, but I just can't seem to make the final step.

I have a label outside my grid that I want to populate with the number of rows in the grid via client-side scripting.

I have my ClientSettings defined with:

<Selecting AllowRowSelect="true" /> 
<ClientEvents onGridCreated="GridCreated" /> 

I have a JavaScript with the following:

function GridCreated(sender, eventArgs)  
{  
    var label = document.getElementById('ctl100_MainContent_gridCount');  
    var grid = sender.get_masterTableView();  
    label.innerHTML = grid.get_pageCount();  
} 

The reason I have get_pageCount() in there was just to make sure I could populate the label. What I want to put in that label is the number of rows in the grid.

I found previous examples of people using Rows.length or MasterTableView.Rows.length, but these throw an error. I think they may have been for the non-Promethius version of the grid.

Can anyone point me in the right direction to get this number? Can I loop through the grid rows somehow to count them or is there any property I can access that will give me what I'm looking for? I need this to be client side so that I can update the row count when a record is added or deleted. Thanks.
Philip
Top achievements
Rank 1
 answered on 11 Feb 2008
1 answer
127 views
I've looked in the 'My Purchases' area of Client.Net but I don't see it. I need to use Prometheus with TreeView so I can access server side events while using ServerSideCallBack:

http://www.telerik.com/community/forums/thread/b311D-ggkcc.aspx

I've managed to get a TreeView to load on demand and store the state as per this guide:

http://www.telerik.com/help/aspnet/treeview/tree_store_expanded_callback.html

The problem is that I need to select nodes with checkboxes and use a button server control to process the selections. I can't get access to the selected node using this method and it seems like Prometheus will allow this.
Simon
Telerik team
 answered on 11 Feb 2008
1 answer
352 views
HI, I have a Prometheus RadGrid that I build dynamically when a user click on a button. With the Prometheus Ajax, I clear all the colunm definition (depending on the button clicked the colunm change) and recreate it. On one situation, I have a template column that display a icon or a blank icon dépending on boolean value. All work good, the first time the grid are created the column header template and the item template work good. But if I click on one item in the grid, the rad ajax update some textbox, but I lost the header and item template.

Any suggestion?

The CreeGridAct are called after a ajaxified postback button click


Create the grid and template dynamically:
 Private Sub CreeGridAct()  
        Dim column1 As GridBoundColumn  
        Dim ColumnTmpl As GridTemplateColumn  
 
        EffaceChamps()  
 
        RadGridUsager.Skin = "WebBlue" 
        RadGridUsager.Width = Unit.Pixel(450)  
        RadGridUsager.PageSize = 15 
        RadGridUsager.AllowPaging = True 
        RadGridUsager.AllowSorting = True 
        RadGridUsager.GridLines = GridLines.Horizontal  
        RadGridUsager.AllowMultiRowSelection = True 
        RadGridUsager.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced  
        RadGridUsager.AutoGenerateColumns = False 
        RadGridUsager.GroupingEnabled = False 
        RadGridUsager.ShowGroupPanel = False 
        RadGridUsager.ShowFooter = True 
 
        RadGridUsager.ClientSettings.AllowDragToGroup = False 
        RadGridUsager.ClientSettings.AllowColumnsReorder = True 
        RadGridUsager.ClientSettings.EnablePostBackOnRowClick = True 
        RadGridUsager.ClientSettings.ApplyStylesOnClient = True 
        RadGridUsager.ClientSettings.Selecting.AllowRowSelect = True 
 
        RadGridUsager.MasterTableView.PageSize = 15 
        RadGridUsager.MasterTableView.Width = Unit.Percentage(100)  
 
        RadGridUsager.MasterTableView.Columns.Clear()  
 
        'Creation des colones pour cet affichage  
        column1 = New GridBoundColumn  
        RadGridUsager.MasterTableView.Columns.Add(column1)  
        column1.DataField = "Usager" 
        column1.HeaderText = "Usager" 
        column1.Visible = False 
 
        column1 = New GridBoundColumn  
        RadGridUsager.MasterTableView.Columns.Add(column1)  
        column1.DataField = "Nom" 
        column1.HeaderText = "Nom" 
 
        column1 = New GridBoundColumn  
        RadGridUsager.MasterTableView.Columns.Add(column1)  
        column1.DataField = "Compagnie" 
        column1.HeaderText = "Compagnie" 
 
        column1 = New GridBoundColumn  
        RadGridUsager.MasterTableView.Columns.Add(column1)  
        column1.DataField = "Ville" 
        column1.HeaderText = "Ville" 
 
        column1 = New GridBoundColumn  
        RadGridUsager.MasterTableView.Columns.Add(column1)  
        column1.DataField = "Telephone" 
        column1.HeaderText = "Téléphone" 
 
        ColumnTmpl = New GridTemplateColumn  
        RadGridUsager.MasterTableView.Columns.Add(ColumnTmpl)  
        ColumnTmpl.UniqueName = "Suspendu" 
        ColumnTmpl.Groupable = False 
        ColumnTmpl.SortExpression = "Suspendu" 
        ColumnTmpl.HeaderStyle.Width = 20 
        ColumnTmpl.HeaderTemplate = New SusHeaderTemplate  
        ColumnTmpl.ItemTemplate = New SusItemTemplate  
 
 
        RadGridUsager.Rebind()  
 
    End Sub  
 
    Private Class SusHeaderTemplate  
        Implements ITemplate  
 
        Public Sub New()  
            MyBase.New()  
        End Sub  
 
        Protected imgSus As Image  
 
        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn  
            imgSus = New Image  
            imgSus.ImageUrl = "images/Misc/suspendu.gif" 
            container.Controls.Add(imgSus)  
        End Sub  
    End Class  
 
    Private Class SusItemTemplate  
        Implements ITemplate  
 
        Public Sub New()  
            MyBase.New()  
        End Sub  
 
        Protected imgSus As Image  
 
        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn  
            imgSus = New Image  
            imgSus.ImageUrl = "images/Misc/Blank.gif" 
            container.Controls.Add(imgSus)  
 
            AddHandler imgSus.DataBinding, AddressOf Me.imgSus_DataBinding  
        End Sub  
 
        Private Sub imgSus_DataBinding(ByVal sender As Object, ByVal e As EventArgs)  
            Dim imgSus As Image = CType(sender, Image)  
            Dim container As GridDataItem = CType(imgSus.NamingContainer, GridDataItem)  
 
            If Convert.ToBoolean(DataBinder.Eval(container.DataItem, "Suspendu")) = True Then  
                imgSus.ImageUrl = "images/Misc/suspendu.gif" 
            Else  
                imgSus.ImageUrl = "images/Misc/blank.gif" 
            End If  
        End Sub  
    End Class 
Rosen
Telerik team
 answered on 11 Feb 2008
1 answer
375 views
I want to get the dataitem of the selected row in a RadGrid, then programmatically bind it to a FormView control.  I have tried...

FormView1.DataSource = RadGrid1.SelectedItems(0)
and
FormView1.DataSource = RadGrid1.SelectedItems(0).Cells
and
FormView1.DataSource = RadGrid1.SelectedItems(0).OwnerTableView.Items

But none of those expose the dataitems associated with the grid.  One other detail is that I want to bind dataitmes that might not necessarily be shown in the grid, but are included in the grid's datasource.

THanks.
Prangadj
Top achievements
Rank 1
 answered on 11 Feb 2008
3 answers
205 views
I want to extend the paragraph style dropdown to enable the user to select one of the following:

Name="Code (C#)" Tag="PRE CLASS="cs""
Name="Code (C++)" Tag="PRE CLASS="cpp"", etc

but is appears that the attribute is ignored when the selected text has the tag applied. Is there any way to get around this? Basically, we want to process each code type differently on the server.
Rumen
Telerik team
 answered on 11 Feb 2008
5 answers
507 views
Hi

I have put the following RegisterClientScriptBlock into a Window to automate closing of the window after a login has been Authenticated.

Call Telerik.Web.UI.RadScriptManager.RegisterClientScriptBlock(Me.Page, Me.Page.GetType, "RadCloseWindow", "alert('Hello'); RadCloseWindow();", True) 

NB: I am using Membership with this login and therefore I have a "Login" control and "LayoutTemplate" on this page.

Kind Regards

David
Georgi Tunev
Telerik team
 answered on 11 Feb 2008
1 answer
108 views
I am looking for a list of client side objects, methods and properties. 

So far as I can tell, the "Prometheus" scheduler documentation only lists of few of these in the course of Client-Side event examples.  For example, I only know that eventArgs.get_appointment().Subject exists because I see it in the OnClientAppointmentClick example.

Is there a comprehensive list elsewhere ?

Thanks for any direction,
Stephen Sjostrom
Peter
Telerik team
 answered on 11 Feb 2008
1 answer
254 views
Hello,
I have the following problem,
Add a link as shown in the code:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" AllowPaging="True" DataSourceID="ODSClassifiedProductDataSource"

GridLines="None" Skin="Default2006" ShowGroupPanel="True" AutoGenerateColumns="False" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"

OnItemDataBound="RadGrid1_ItemDataBound1" OnItemCreated="RadGrid1_ItemCreated" Width="776px">

<MasterTableView CommandItemDisplay="Top" EditMode="InPlace" Frame="Border" Dir="LTR" DataSourceID="ODSClassifiedProductDataSource" CurrentResetPageIndexAction="SetPageIndexToFirst" TableLayout="Auto" DataKeyNames="ProductCode">

<CommandItemTemplate>

<div style="padding:0 5px;">

<asp:LinkButton ID="LinkButton5" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../Images/Contents/Forward.gif" /></asp:LinkButton

>

</div>

</CommandItemTemplate>

<EditFormSettings>

<EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"></EditColumn>

</EditFormSettings>

<ExpandCollapseColumn Visible="False" Resizable="False" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">

<HeaderStyle Width="20px"></HeaderStyle>

</ExpandCollapseColumn>

<RowIndicatorColumn Visible="False" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">

<HeaderStyle Width="20px"></HeaderStyle>

</RowIndicatorColumn>

<HeaderStyle BackColor="#5959EE" />

<Columns>

<telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="ProductCode"

FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="Product Code"

SortExpression="ProductCode" UniqueName="ProductCode" >

</telerik:GridBoundColumn>

<telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="ProductCodeName"

FilterListOptions="VaryByDataType" ForceExtractValue="None" HeaderText="Description"

SortExpression="ProductCodeName" UniqueName="ProductCodeName">

</telerik:GridBoundColumn>

<telerik:GridEditCommandColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">

</telerik:GridEditCommandColumn>

<telerik:GridTemplateColumn UniqueName="TemplateDeleteColumn" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None" >

<ItemTemplate >

<asp:LinkButton CommandName="Delete" ID="DeleteLink" runat="server" Text="Delete" ></asp:LinkButton>

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

<EditItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"

Font-Underline="False" Wrap="True" />

</MasterTableView>

<GroupPanel ID="GroupPanel" Style="width: 100%;" Visible="True">

</GroupPanel>

<ClientSettings AllowDragToGroup="True">

</ClientSettings>

<PagerStyle Mode="NextPrevNumericAndAdvanced" />

<ExportSettings>

<Pdf FontType="Subset" PaperSize="Letter" />

<Excel Format="Html" />

</ExportSettings>

</telerik:RadGrid>

And in de RadGrid show the insert and cancel button, when i click in the insert button the page throw the next error:

System.Reflection.TargetInvocationException: Se produjo una excepción en el destino de la invocación. ---> System.Exception: Can't save: Product_code requires a value

   en SubSonic.ActiveRecord`1.Save(String userName)
   en ConnecsysDAL.General.ClassifiedProduct.Save(String user, String oldStampBA) en C:\Connecsys\ConnecsysSource\GenericDAL\Generated\Models\ClassifiedProduct.cs:línea 359
   en ConnecsysDAL.General.ClassifiedProduct.Save(String UserName) en C:\Connecsys\ConnecsysSource\GenericDAL\Generated\Models\ClassifiedProduct.cs:línea 333
   en ConnecsysDAL.General.ClassifiedProductController.Insert(String ProductCode, String ProductCodeName) en C:\Connecsys\ConnecsysSource\GenericDAL\Generated\Controllers\ClassifiedProductController.cs:línea 115
   --- Fin del seguimiento de la pila de la excepción interna ---
   en System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   en System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   en System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   en System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   en System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   en System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)
   en System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method)
   en System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary values)
   en System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback)

Thanks

Juan.

Yavor
Telerik team
 answered on 11 Feb 2008
4 answers
184 views
I'm currently developing an large application that makes judicious use of Telerik controls most of which at this point are Prometheus controls. One problem I am seeing on a regular basis are javascript errors which then halt all further javascript on a given page. Obviously, my team and I are working on resolving these issues as much as possible. For example, we abandoned all use of the AJAX control toolkit controls so that we are only using standard ASP.NET controls or Telerik controls and preferably Prometheus controls to mitigate the sources of javascript.

However, I see a serious support problem when I get ready to deploy. I will have no information about when and what error occurred if it is in javascript. If an error occurs on the server, I get a full stack trace and the user gets a clear indication that something went wrong. When it occurs in javascript, I get no information that an error occurred and the user has to be watchful for small error icons in their browser to note that a javascript error has occurred.

Thomas
Top achievements
Rank 1
 answered on 11 Feb 2008
1 answer
168 views
If a add radScriptmanager to my web page i'm no more able to resize cells of table in Visual Studio 2005 WebForm designer. Any ideas?
Peter
Telerik team
 answered on 11 Feb 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?