Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
77 views
I am using a datetimecolumn with filtering in radgrid. How can I show today's date as selected on opening the filter pop up?
Princy
Top achievements
Rank 2
 answered on 05 Nov 2012
1 answer
170 views
I have a RadGrid that I added an ItemCommand event to. The UI uses Twitter Bootstrap to open a modal window, this window has a textbox and a send button with a command name and command argument.  When I click the button, I get :

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.




ASPX:
<telerik:RadGrid ID="MyGrid" OnItemCommand="MyGrid_ItemCommand"
        Skin="Sitefinity" AllowSorting="True" AutoGenerateColumns="false" AllowPaging="True"
        PageSize="10" runat="server" GridLines="None" Width="100%">
        <PagerStyle EnableSEOPaging="true" SEOPagingQueryStringKey="p" Mode="NumericPages">
        </PagerStyle>
        <MasterTableView>
            <Columns>
                <telerik:GridTemplateColumn HeaderStyle-Font-Bold="true">
                    <ItemTemplate>
                        <%#Eval("Name")%></ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderStyle-Font-Bold="true" HeaderText="Progress">
                    <ItemTemplate>
                        <div class="progress progress-success progress-striped" style="position: relative;
                            top: 10px;">
                            <asp:Panel runat="server" ID="progressBar" EnableViewState="false" CssClass="bar progress">
                                <%#Eval("Complete")%>
                                /
                                <%#Eval("TotalCount")%>
                            </asp:Panel>
                        </div>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderStyle-Font-Bold="true" HeaderText="Manage" ItemStyle-Width="220px">
                    <ItemTemplate>
                        <div class="btn-group">
                            <asp:HyperLink ID="matchLink" CssClass="btn" runat="server" Style="color: #333 !important;"
                                Text="<i class='icon-check'></i> Match" />
                            <button class="btn dropdown-toggle" data-toggle="dropdown">
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                                <li><a href="#message" data-toggle="modal"><i class='icon-envelope-alt'></i>Send Message</a></li>
                                <li>
                                    <asp:LinkButton ID="downloadLinks" runat="server" Text="<i class='icon-download-alt'></i> Download Data" /></li>
                            </ul>
                        </div>
                        <!-- Modal -->
                        <div id="message" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
                            aria-hidden="true">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                    Ã—</button>
                                <h3 id="myModalLabel">
                                    Send Message</h3>
                            </div>
                            <div class="modal-body">
                                    <asp:TextBox TextMode="MultiLine" ID="messageTextBox" Width="500px" placeholder="Type your message here…"
                                        runat="server" Rows="10"></asp:TextBox>
                                 
                            </div>
                            <div class="modal-footer">
                                <button class="btn" data-dismiss="modal" aria-hidden="true">
                                    Cancel</button>
                                <asp:Button ID="sendMessageButton" CommandName="SendMessage" CommandArgument='<%#Eval("Id")%>'
                                    CssClass="btn btn-primary" Text="Send" runat="server" />
                            </div>
                        </div>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>

Code-behind:
protected void MyGrid_ItemCommand(object sender, GridCommandEventArgs e)
        {
            // code
        }
Shinu
Top achievements
Rank 2
 answered on 05 Nov 2012
3 answers
464 views
What is the easiest way to disable or hide the close button on a RadDock?

Thank you!

Madhav Joshi
Top achievements
Rank 2
 answered on 04 Nov 2012
4 answers
141 views
Hi,

I've used the RowDetailsTemplate tag in the Silverlight version of the Grid and can't seem to be able to reproduce this same functionality in .Net AJAX. How could I achieve this? I basically need a panel with some text to show up when someone clicks on an item.

Thanks,


Roberto
Top achievements
Rank 1
 answered on 03 Nov 2012
1 answer
1.3K+ views
Hi
Is it possible to enable/disable icons of telerik:GridButtonColumn in grid rows?
I want to disable "delete icon" for some grid rows through binding expression (or by OnItemDataBound) . 
&
Why this type of column does not support binding expression for
CommandArgument
?
Thank you very much.
Jayesh Goyani
Top achievements
Rank 2
 answered on 03 Nov 2012
3 answers
123 views
I have 3 columns and a template column the gets the percent of the other 3. I want to sort the template column highest to lowest. How can this be done?
Jayesh Goyani
Top achievements
Rank 2
 answered on 03 Nov 2012
4 answers
566 views
I have been wrestling with this on and off over the last couple days, and have not yet found a good basic sample. I am managing data in a business layer, so what I'm passing into the grid are lists of objects. For simplicity, let's say the two lists are:

The rows are:
ClientId
ClientName
ContactId
ContactName
ContactTypeId

The ContactTypeId column needs to provide a lookup, and on ItemDataBound I am passing a list of:
ContactTypeId
ContactTypeName

So far I have gotten it to almost work in several ways, but there always seems to be some weird behavior. Is there a good sample somewhere with the fields to set to connect up the name and id on the lookup column, and to display the correct choice on view and when the dropdown first enters edit mode. Sorry if I'm missing something obvious, I feel like I'm running into a (very hard) wall.

Cheers.
Damon
Top achievements
Rank 1
 answered on 02 Nov 2012
3 answers
361 views
When an exception occurs during the ItemsRequested event, a RadWindow is displayed to the user with the message "There was an error in the callback."

Instead, I want the exception to bubble up to Application_Error in global.asax, where I have implemented centralized error handling/logging for the web site. This centralized error handling logs the error and redirects the user to a common error page. 

I have many other pages in the website where I use RadAjaxManager to perform AJAX-updates. If an exception occurs on the server during one of these AJAX-postbacks, I am able to route the exception through Application_Error by setting web config's customErrors to "On" and setting AllowCustomErrorsRedirect to "true" for the ScriptManager. However, these settings do not seem to have any affect on exceptions that occur during the ItemsRequested event of RadCombo.

I understand that you can call a custom javascript function by setting the "OnClientItemsRequestFailed" property on RadCombo, or that I can swallow the exception by putting a try/catch block around the code in the OnItemsRequested server-side event handler. However, neither of these options meet my needs.

Is there a way to tell RadCombo to allow exceptions that occur during the ItemsRequested event to bubble up to Application_Error?

Thank you.
John
Top achievements
Rank 1
 answered on 02 Nov 2012
2 answers
226 views
Hi,

I am trying to use the RadGrid control to implement a table
that has a field indicating if the record is a favourite,
based upon a database bit field. In the RadGrid the field is
an image button.
I am using the RadGrid_ItemCommand event
to toggle the status of the flag in the database for the record
that the user clicked on.
I use the item.GetDataKeyValue("<DataKeyField>") to get the IDs that are
used to identify the record to toggle.

The problem:
The value returned by item.GetDataKeyValue("cli_id") is not
always correct. It is sometimes a value corresponding to a
different row.
I also tried using the CommandArgument property, but that has the
same behavior.

How do I get the correct value for the row that was clicked on

by the user?

Here is the RadGrid_ItemCommand event:

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
    Trace.Write("RadGrid1_ItemCommand: starting up...");
    if (e.CommandName == "ChangeStatus")
    {
        GridDataItem item = (GridDataItem)e.Item;
 
        //Get the record IDs from the DataKeyNames
        System.Data.DataRowView oRow = (System.Data.DataRowView)item.DataItem;
        int iApp_id = Convert.ToInt32(item.GetDataKeyValue("app_id"));
        int iCli_id = Convert.ToInt32(item.GetDataKeyValue("cli_id"));
        bool bIsFav = Convert.ToBoolean(item.GetDataKeyValue("IsFav"));
        Trace.Write("RadGrid1_ItemCommand: iApp_id: " + iApp_id);
        Trace.Write("RadGrid1_ItemCommand: cli_id: " + iCli_id);
        Trace.Write("RadGrid1_ItemCommand: bIsFav: " + bIsFav);
        int itmp = Convert.ToInt32(e.CommandArgument);
 
        //Toggle the Favorite status for that combination
        SqlConnection oConn = new SqlConnection(SqlDataSource_GridViewSolutions.ConnectionString);
        SqlCommand oCmd = new SqlCommand("toggle_gru_IsFav_Status", oConn);
        oCmd.CommandType = System.Data.CommandType.StoredProcedure;
 
        //ToDo make User name dynamic: oCmd.Parameters.Add(this.Page.User.Identity.Name);
        oCmd.Parameters.Add(new SqlParameter("strLoginID", "the_user"));
        oCmd.Parameters.Add(new SqlParameter("app_id", iApp_id));
        oCmd.Parameters.Add(new SqlParameter("cli_id", iCli_id));
        try
        {
            oConn.Open();
            oCmd.ExecuteNonQuery();
        }
        catch (Exception ex1)
        {
            Response.Write("Error updating favorite status: " + ex1.Message);
        }
        finally
        {
            oConn.Close();
            oConn.Dispose();
        }
        RadGrid1.Rebind();
    }

Here is the markup for the RadGrid control:

<div class="apps_by_clients">
    <asp:SqlDataSource ID="SqlDataSource_GridViewSolutions"
        ConnectionString="Data Source=BTSLSQLDEV01;Initial Catalog=GenericStorage;User ID=userid;pwd=xxxxxxxxx"
        SelectCommand="EXEC GetAppsWithFavStatus 'the_user'"
        runat="server" />
</div>
  
<telerik:RadGrid ID="RadGrid1" runat="server" 
    AllowPaging="True" 
    CellSpacing="0" 
    DataSourceID="SqlDataSource_GridViewSolutions" 
    GridLines="None" 
    PageSize="30" 
    Skin="Vista" 
    Width="720px"
    AutoGenerateColumns="False"
    AllowFilteringByColumn="True"
    GroupingSettings-CaseSensitive="false" 
    onitemcommand="RadGrid1_ItemCommand" 
    OnPreRender="RadGrid1_PreRender">
    <MasterTableView 
    DataSourceID="SqlDataSource_GridViewSolutions"
    GroupsDefaultExpanded="false"
    DataKeyNames="app_id, cli_id, IsFav"
    >
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
  
        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
  
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn DataField="cli_name" 
                FilterControlAltText="Filter cli_name column" HeaderText="cli_name" 
                UniqueName="cli_name" SortExpression="cli_name">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="app_name" 
                FilterControlAltText="Filter app_name column" HeaderText="app_name" 
                SortExpression="app_name" UniqueName="app_name">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="app_id" DataType="System.Decimal" 
                FilterControlAltText="Filter app_id column" HeaderText="app_id" ReadOnly="True" 
                SortExpression="app_id" UniqueName="app_id">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn DataField="IsFav" 
                HeaderText="Favourite?" 
                UniqueName="IsFav"
                AllowFiltering="false"
                >
                <ItemTemplate>
                    <asp:ImageButton ID="ImageButton1" runat="server" 
                        ImageUrl='./'
                        CommandName="ChangeStatus"
                        CommandArgument='<%# Eval("cli_id") %>'
                        />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
        </EditFormSettings>
        <PagerStyle PageButtonCount="5" />
    </MasterTableView>
  
    <PagerStyle PageButtonCount="5" />
  
    <FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>

We are using ASP.Net 4.0 on Windows server 2008
We are using 2012.2.607.40 of the Telerik Radcontrols


Cheers,
Geoff

BtsiTech
Top achievements
Rank 1
 answered on 02 Nov 2012
4 answers
78 views
Hi,

I've just installed the new Q2 version of the controls and in the main all is fine.  I have however noticed that in Chrome I end up with an extra margin inside a RadSplitter.  So I tried to inspect the CSS with Chrome, as soon as I try the margin collapses and the page looks as it should.  I've deleted as much as possible on the page to get to a working example.  The following code works in Chrome, you should see a left blue column,  the right column has some text,  the text appears maybe 15-20px away from the blue panel, if you now open it up for inspection the margin disappears.

Note that if you refresh the page with the inspector open in chrome then the margin appears for half a second or so then disappears.

Regards,

Jon

<head id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        html, body, form
        {
            height: 100%;
            margin: 0px;
            padding: 0px;
            overflow: hidden;
        }
        .surroundPaneBackground
        {
             background-color: #8ba0bc;
             height: 100%;
             width: 100%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadStyleSheetManager ID="pgRadStyleSheetManager" runat="server"></telerik:RadStyleSheetManager>
        <telerik:RadScriptManager ID="pgRadScriptManager" runat="server"></telerik:RadScriptManager>
        <div id="ParentDivElement" style="height: 100%;">
            <telerik:RadSplitter ID="uxRadSplitter" runat="server" Height="100%" Width="100%" Orientation="Vertical" LiveResize="true" BorderSize="0">
                <telerik:RadPane ID="uxRadPaneLeft" runat="server" MinWidth="0"><div class="surroundPaneBackground"></div></telerik:RadPane>
                <telerik:RadPane ID="uxRadPaneMain" runat="server" Scrolling="none" Width="850">
                    <telerik:RadSplitter ID="RadSplitter1" runat="server" Height="100%" Orientation="Horizontal" LiveResize="true" BorderSize="0">
                        <telerik:RadPane ID="uxRadPaneContent" runat="server" Scrolling="none" >
                        aaaa
                        </telerik:RadPane>
                    </telerik:RadSplitter>
                </telerik:RadPane>
            </telerik:RadSplitter>
        </div>
    </form>
</body>
</html>


Vessy
Telerik team
 answered on 02 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?