Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
195 views
I really didn't think this would be that hard.  I've found one other example, but it doesn't seem to work for me.

All  I need to do is, using Javascript on the client side, go through the rows in a data grid, see if the checkbox is check then look at another column in that row to see if it has a value, and then count the checked items.  I know it sounds silly, but we are trying to limit the number of checkboxes actually selected so that everything selected gets printed.  If too many are selected, the reporting tool just doesn't print ANYTHING (I'll save THAT for another post ;~)

Here's the code I have so far:

    function CheckboxCheckedChanged() {
        var grid = document.getElementById('<%= FormView1.FindControl("rgContactsDisplay").ClientID %>');
        var inputElements = grid.get_dataItems();  //THIS IS THE LINE THAT DOESN'T WORK
        var index;
        var MAX = 10;
        var remaining;
        var hldCompany = null;

        for (index = 0; index < inputElements.length; index++) {

              if (inputElements[index].id.indexOf("chkContacts") != -1) {
                if (inputElements[index].checked == true) {
                    // If First row
                    if (hldCompany == null) {
                        hldCompany = grid.rows[index].cells[2]   //grid.row(2);
                    }

                    //If I already have this company, just add 1 for the contact if it’s there
                    if (hldCompany == grid.rows[index].cells[2]) {
                        if (grid.rows[index].cells[3] != null &&
                            grid.rows[index].cells[3] != '&nbsp;') {
                            remaining = remaining + 1;
                            break;
                        }
                    }
                    else {
                        hldCompany = grid.rows[index].cells[2];

                        if (grid.rows[index].cells[3] != null &&
                            grid.rows[index].cells[3] != '&nbsp;') {
                            remaining = remaining + 2;
                            break;
                        }
                        else {
                            remaining = remaining + 1;
                            break;
                        }
                    }
                }
            }
        }

        remaining = MAX - remaining;

        if (remaining < 0) {
            alert("Too many contacts selected for printing");
        }
    }

I've tried a number of different things for the line that doesn't work, but so far the only thing I'm getting is that the "object doesn't support" the method...or errors similar.

I was able to finally get an object from the line above that so I THINK I have a grid to process.

Thanks for any help...

Rich

Andrey
Telerik team
 answered on 16 Oct 2012
1 answer
172 views
Hello,

In my application I've implemented a search page with 3 instances of a user control using a RadGrid. As the page reloads to Rebind the data (using the search text), I gete the following error.

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.

I've read quite a few articles about this error and the theory about it I do understand. But I can't seen to figure out how to solve it. I believe the Edit-button (ButtonType = "ImageButton") is causing the error, because it is not yet registered for event validation.

How can I accomplish that each edit button is registered?
Arno
Top achievements
Rank 1
 answered on 16 Oct 2012
1 answer
299 views
Hi All,

I have a client project where one of the requests is to export Charts to Excel or powerPoint but with all their data included and NOT as image only. Is any of these two exports achievable with either RadChart or RadHtmlChart? Is it maybe possible to serialise the chart information to Open XML that Office products are able to manipulate? Any recommendations and/or ideas are more than welcome.

Thanks a lot,

Christos
Marin Bratanov
Telerik team
 answered on 16 Oct 2012
1 answer
63 views
Is there any guidance for mobile browser usage of a decorated drop-down list?

We've recently gotten some comments that a DDL may be unusable on some devices.  I know that a decorated DDL doesn't bring up a mobile browser's native selection box, because it isn't implemented as an html select.  So its a minor usability concern that the options are a bit harder to select than they would normally be.

The big problem I am seeing is that if the list is long, the mobile user is unable to scroll the items in the list.  This is the case on my Android 2.3.4 phone, and I'm told it is true on an iPhone as well.  A scrollbar does not appear on the right side of the list like it does on the desktop version.  I tested a couple of other browsers as well, and they are all the same.  I would consider this a bug, but I'm not sure if mobile support is quite complete.

I've been pretty pleased with the fact that pretty much everything we've done with Telerik has worked on mobile, so I'm hoping this is a minor glitch!

Joel

Bozhidar
Telerik team
 answered on 16 Oct 2012
4 answers
333 views
Hi,

I probably missing something put when i try to use the RadTreeView for databinding there nothing showing!
The page is blank
Any idea??

Is there something i am missing or is there a bug?
I try the same thing in code behind with the same result!
Any tips or advise are welcome

Tks in advance

<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        
       <telerik:RadTreeView runat="server" ID="RadTreeView1" DataSourceID="SqlDataSource1"
           DataFieldID="id" DataFieldParentID="parentID" CheckBoxes="true">
           <DataBindings>
               <telerik:RadTreeNodeBinding TextField="Text" />
               <telerik:RadTreeNodeBinding Depth="0" Checkable="false" TextField="Text2" Expanded="true"
                    />
           </DataBindings>
       </telerik:RadTreeView>
        
       
   <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:xxxx%>"
    SelectCommand="uspListRegionEcole" SelectCommandType="StoredProcedure"  />
Bozhidar
Telerik team
 answered on 16 Oct 2012
0 answers
126 views

Hi,

I m using telerik grid with grouped by month.

now my criteria is i want to show current month group first  and then remaining group with order by asc .

Is there any way to accomplish this?.

Thanks in advance.
Parimal
Top achievements
Rank 1
 asked on 16 Oct 2012
3 answers
403 views
I'm getting the following error when trying to use a radcombobox inside GridTemplateColumn with inplace editing (i.e. using bind to SelectedValue).

Error:
Cannot insert the value NULL into column 'GroupTitle', table 'cms_XXXXX.dbo.cmsContentRelatedGroup'; column does not allow nulls. INSERT fails.

Why would the control pass a null value when the user enters a new "custom text" item?  Any help would be most appreciated.


Below is my RadGrid:

<telerik:RadGrid ID="rgContentRelatedGroup" runat="server" GridLines="None"
                        AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
                        AutoGenerateColumns="False" DataSourceID="odsContentRelatedGroup" ShowStatusBar="True">
                        <MasterTableView EditMode="InPlace" DataKeyNames="ContentRelatedGroupID"
                            CellPadding="4" CellSpacing="1" CommandItemDisplay="TopAndBottom">
                            <AlternatingItemStyle CssClass="row-alt" />
                            <ItemStyle CssClass="row" />
                            <CommandItemSettings AddNewRecordImageUrl="~/images/admin/icons/add.gif" AddNewRecordText="Add new quick link category" />
                             <Columns>
                                <telerik:GridBoundColumn DataField="ContentRelatedGroupID" DataType="System.Int32" HeaderText="ContentRelatedGroupID"
                                    ReadOnly="True" Visible="False" SortExpression="ContentRelatedGroupID" UniqueName="ContentRelatedGroupID">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ContentID" DataType="System.Int32" HeaderText="ContentID"
                                    ReadOnly="True" Visible="False" SortExpression="ContentID" UniqueName="ContentID">
                                </telerik:GridBoundColumn>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" 
                                        UpdateImageUrl="~/images/admin/icons/update.gif"
                                        EditImageUrl="~/images/admin/icons/edit.gif" 
                                        InsertImageUrl="~/images/admin/icons/add.gif"
                                        CancelImageUrl="~/images/admin/icons/cancel.gif" HeaderText="Action">
                                    <HeaderStyle Width="55px" />
                                    <ItemStyle VerticalAlign="Top" />
                                </telerik:GridEditCommandColumn>
                                <telerik:GridTemplateColumn HeaderText="Category Title" UniqueName="columnRelatedGroup" ItemStyle-VerticalAlign="Top">
                                    <ItemTemplate>
                                        <%# Eval("GroupTitle")%>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadComboBox
                                             ID="rcbGroupTitle" runat="server"
                                             Width="165px" Height="200px"
                                             EmptyMessage="Select a Category"
                                             DataSourceID="odsAllContentRelatedGroup" DataTextField="GroupTitle" DataValueField="GroupTitle"
                                             AllowCustomText="true" MarkFirstMatch="true" SelectedValue='<%# Bind("GroupTitle") %>' AppendDataBoundItems="true">
                                        </telerik:RadComboBox>
                                        <asp:RequiredFieldValidator runat="server" id="reqGroupTitle" ControlToValidate="rcbGroupTitle" ErrorMessage="Category Title" display="Dynamic"><br />Category Title is a required field</asp:RequiredFieldValidator>                        
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Sort Order" UniqueName="columnSortOrder" ItemStyle-VerticalAlign="Top">
                                    <ItemTemplate>
                                        <%# Eval("Rank")%>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="tbGroupSortOrder" runat="server" Width="50" Text='<%# Bind("Rank") %>'></asp:TextBox>
                                        <asp:CompareValidator ID="cvGroupSortOrder" runat="server" Operator="DataTypeCheck" Type="Integer" ControlToValidate="tbGroupSortOrder" ErrorMessage="Sort Order" Display="Dynamic"><br />Sort Order must be a number</asp:CompareValidator>
                                        <asp:RequiredFieldValidator runat="server" id="reqGroupSortOrder" ControlToValidate="tbGroupSortOrder" ErrorMessage="Sort Order" display="Dynamic"><br />Sort Order is a required field</asp:RequiredFieldValidator>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>                          
                                <telerik:GridTemplateColumn HeaderText="Last Updated" UniqueName="columnLastUpdated" ItemStyle-VerticalAlign="Top">
                                    <ItemTemplate>
                                        <%# Eval("DateUpdated")%>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Updated By" UniqueName="columnUpdatedBy" ItemStyle-VerticalAlign="Top">
                                    <ItemTemplate>
                                        <%# Eval("UpdatedBy")%>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridButtonColumn ConfirmText="Delete this category and all links associated with it?" HeaderText="Delete" ButtonType="ImageButton" ImageUrl="~/images/admin/icons/delete.gif" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" ItemStyle-VerticalAlign="Top">
                                    <HeaderStyle Width="20px" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </telerik:GridButtonColumn>      
                            </Columns>
                            <EditFormSettings ColumnNumber="2">
                                <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                                <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                                <FormMainTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="3" BackColor="White"
                                    Width="100%" />
                                <FormTableStyle CellSpacing="0" CellPadding="2" CssClass="module" Height="110px"
                                    BackColor="White" />
                                <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                                <EditColumn ButtonType="ImageButton" UpdateImageUrl="~/images/admin/icons/update.gif"
                                    EditImageUrl="~/images/admin/icons/edit.gif" InsertImageUrl="~/images/admin/icons/add.gif"
                                    CancelImageUrl="~/images/admin/icons/cancel.gif" InsertText="Insert record" UpdateText="Update record"
                                    UniqueName="ContentGroupEditCommandColumn" CancelText="Cancel edit">
                                </EditColumn>
                                <FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle>
                            </EditFormSettings>
                            <ExpandCollapseColumn Visible="False">
                                <HeaderStyle Width="19px" />
                            </ExpandCollapseColumn>
                            <RowIndicatorColumn Visible="False">
                                <HeaderStyle Width="20px" />
                            </RowIndicatorColumn>
                        </MasterTableView>
                    </telerik:RadGrid>

And here are the two datasources:

<asp:ObjectDataSource ID="odsAllContentRelatedGroup" runat="server" SelectMethod="GetAllContentRelatedGroup" 
                        TypeName="dsCmsContentTableAdapters.cmsContentRelatedGroupTableAdapter">
                    </asp:ObjectDataSource>
                    
                    <asp:ObjectDataSource ID="odsContentRelatedGroup" runat="server" DeleteMethod="DeleteContentRelatedGroup"
                        InsertMethod="InsertContentRelatedGroup" SelectMethod="GetContentRelatedGroupByContentID" TypeName="dsCmsContentTableAdapters.cmsContentRelatedGroupTableAdapter"
                        UpdateMethod="UpdateContentRelatedGroup">
                        <SelectParameters>
                            <asp:SessionParameter Name="ContentID" SessionField="ContentID" Type="Int32" />
                        </SelectParameters>
                        <InsertParameters>
                            <asp:SessionParameter Name="ContentID" SessionField="ContentID" Type="Int32" />
                            <asp:Parameter Name="GroupTitle" Type="String" />
                            <asp:Parameter Name="Rank" Type="Int32" />
                            <asp:SessionParameter Name="CreatedBy" SessionField="Username" Type="String" />
                            <asp:Parameter Direction="InputOutput" Name="NewContentRelatedGroupID" Type="Object" />
                        </InsertParameters>
                        <DeleteParameters>
                            <asp:Parameter Name="ContentRelatedGroupID" Type="Int32" />
                        </DeleteParameters>
                    </asp:ObjectDataSource>

And finally the stack:

System.Reflection.TargetInvocationException was unhandled by user code
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)
       at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary values)
       at System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback)
       at Telerik.Web.UI.GridTableView.PerformInsert(GridEditableItem editedItem, Boolean suppressRebind)
       at Telerik.Web.UI.GridTableView.PerformInsert(GridEditableItem editedItem)
       at Telerik.Web.UI.GridTableView.PerformInsert()
       at Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source)
       at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)
       at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
       at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
       at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
       at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
       at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
       at System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e)
       at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at admin_content_edit.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) in e:\work\wwwroot\cms.wageworks\admin\content-edit.aspx.cs:line 359
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: System.Data.SqlClient.SqlException
       Message=Cannot insert the value NULL into column 'GroupTitle', table 'cms_XXXXXX.dbo.cmsContentRelatedGroup'; column does not allow nulls. INSERT fails.
The statement has been terminated.
       Source=.Net SqlClient Data Provider
       ErrorCode=-2146232060
       Class=16
       LineNumber=17
       Number=515
       Procedure=usp_cmsContentRelatedGroupINSERT
       Server=XXXXXXXXXX
       State=2
       StackTrace:
            at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
            at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
            at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
            at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
            at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
            at System.Data.SqlClient.SqlDataReader.get_MetaData()
            at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
            at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
            at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
            at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
            at System.Data.SqlClient.SqlCommand.ExecuteScalar()
            at dsCmsContentTableAdapters.cmsContentRelatedGroupTableAdapter.InsertContentRelatedGroup(Nullable`1 ContentID, String GroupTitle, Nullable`1 Rank, String CreatedBy, Nullable`1& NewContentRelatedGroupID) in c:\Users\mrhigh\AppData\Local\Temp\Temporary ASP.NET Files\root\98f11740\866a4947\App_Code.6d7gpkps.5.cs:line 16649
       InnerException: 

Shinu
Top achievements
Rank 2
 answered on 16 Oct 2012
3 answers
126 views
I want to loop through a hierarchy radgrid to find a  specific value within the 2nd level of the rad grid's hierarchy.  I do not want the value of the key, but the values of other columns within the 2nd level of the hierarchy.  How can I loop through the items to obtain these values.  This is what I have so far, but it does not work....

   Protected Sub RadGrid_Inventory_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid_Inventory.PreRender


            For Each item As GridDataItem In RadGrid_Inventory.Items
                If (item.OwnerTableView.Name = "Inv_Desc") Then


                Dim lblRowID As Label = DirectCast(item.FindControl("lblRowID"), Label)
                Dim Delete As ImageButton = DirectCast(item.FindControl("Delete"), ImageButton)
            

                If lblRowID.Text = -1 Then
                    Delete.Visible = False
                Else
                    Delete.Visible = True
                End If


                End If
            Next
    End Sub
Aret
Top achievements
Rank 1
 answered on 16 Oct 2012
2 answers
115 views

Hi,

My team is having an issue with the NumericTextBox and the developer currently having the issue asked that I post his question in the forum on his behalf since he is having a technical issue with his workstation that is preventing him from posting himself.

"Using the NumericTextbox, I am seeing behavior that is not the way that I want or expect. I have a MinValue="0" and a MaxValue="100". I have a InvalidStyleDuration="2000000".

When the user enters -1, the textbox border turns red and there is an invalid icon in the textbox. What is happening that I don't want is that the -1 value that was entered is replaced by the MinValue, 0. How can I get the entered value, -1, to remain in the textbox?"

Thanks,

Andrew

Andrew
Top achievements
Rank 1
 answered on 15 Oct 2012
2 answers
247 views
Hi,

My team is having an issue with the NumericTextBox and the developer currently having the issue asked that I post his question in the forum on his behalf since he is having a technical issue with his workstation that is preventing him from posting himself.

"I have a NumericTextBox that has MinValue and MaxValue properties.I have a ValidationSummary control which has a RequiredFieldValidator connected to another asp.net TextBox control.

When the user hits the Save button and validation takes place, is there a way for invalid values in the NumericTextBox control, for example value entered is less than the MinValue, to be displayed in the ValidationSummary control without hooking up an additional asp.net validation control?"

Thanks,

Andrew

Andrew
Top achievements
Rank 1
 answered on 15 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?