Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
92 views

Hi Support Team,

I have set Radgrid page size 10 (Please check attached image1.png).  And make group by column1 by drag. I get output at page1 in two groups. Group1 has 3 records and Group2 has 7 records( Ref -Image2.png).

Now I am collapse group1, so it displays collapsed Group1 and Group2 with 7 records (ref-Image3.png).

But is there any way to display total 10 records without considering collapsed record?

Thanks in advance.


Pavlina
Telerik team
 answered on 18 Apr 2012
1 answer
143 views
The Setup: RadGrid, inside user control, that features several details tables. The grid view in question is the OrderNotesLevel. This user control is called from our research page. 

The Problem: The user control OrderNotesEntry.ascx is throwing an error in the binding saying the dataitem doesn't contain property xxx. When I debug I see the dataitem has no properties in the collection at all. The error occurs when adding a new order note record.

Grid structure:
Order
- OrderDetails
--SKU
-Order Notes (for sales team) <- where my problem(s) are

ASPX:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Example.ascx.cs" Inherits="ExampleUC" %>
<br />
<telerik:RadAjaxPanel ID="rapExample" runat="server">
    <div style="display: none; visibility: hidden;">
        <asp:Label ID="lblOrderId" runat="server" Text="-1"></asp:Label>
    </div>
    <telerik:RadGrid ID="rgExample" runat="server" Width="1020px" ShowStatusBar="true" AutoGenerateColumns="False"
        PageSize="10" AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True"
        OnDetailTableDataBind="rgExample_DetailTableDataBind" OnNeedDataSource="rgExample_NeedDataSource"
        OnPreRender="rgExample_PreRender" GridLines="Horizontal" OnItemDataBound="rgExample_ItemDataBound"
        OnUpdateCommand="rgExample_UpdateCommand" OnInsertCommand="rgExample_InsertCommand" OnDeleteCommand="rgExample_DeleteCommand"
        OnItemCommand="rgExample_ItemCommand">
        <PagerStyle Mode="NumericPages"></PagerStyle>
        <MasterTableView Width="100%" DataKeyNames="OrderId" Name="OrderLevel" HierarchyDefaultExpanded="true"
            GroupLoadMode="Client" TableLayout="Fixed">
            <Columns>
                <telerik:GridBoundColumn SortExpression="OrderOwner" HeaderText="Order Owner" DataField="OrderOwner"
                    DataType="System.String" HeaderStyle-Width="10em" HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="OrderDate" HeaderText="Closed Date"
                    DataField="OrderDateClosed" DataType="System.String" HeaderStyle-Width="5.5em"
                    HeaderStyle-HorizontalAlign="Center">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn SortExpression="OrderFactors" HeaderText="Order Risk Factor"
                    DataField="OrderRiskFactor" DataType="System.String" HeaderStyle-Width="9.0em"
                    HeaderStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <div class='<%#Eval("OrderFactorColor")%>'>
                            <asp:Label ID="lblOrderFactor" runat="server" Text='<%#Eval("OrderFactor")%>'></asp:Label>
                        </div>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
            <DetailTables>
                <telerik:GridTableView DataKeyNames="DetailCode" Name="DetailLevel" Width="100%" HierarchyDefaultExpanded="true"
                    GridLines="None" AllowPaging="false">
                    <Columns>
                        <telerik:GridBoundColumn SortExpression="DetailCode" HeaderText="DetailCode" DataField="DetailCode"
                            DataType="System.String">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="DetailDescr" HeaderText="Description" DataField="DetailDescr"
                            DataType="System.String">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="DetailDate" HeaderText="First Treatment Date"
                            DataField="DetailDate" DataFormatString="{0:d}" DataType="System.DateTime" HeaderStyle-Width="6em">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <DetailTables>
                        <telerik:GridTableView DataKeyNames="Id" Name="SKULevel" Width="100%" HierarchyDefaultExpanded="true"
                            CellPadding="5" GridLines="None" AllowPaging="false">
                            <Columns>
                                <telerik:GridBoundColumn SortExpression="SKUDate" HeaderText="Date" DataField="SKUDate"
                                    DataFormatString="{0:d}" DataType="System.DateTime" HeaderStyle-Width="30px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="ReqType" HeaderText="Req Type" DataField="ReqType"
                                    DataType="System.String" HeaderStyle-Width="200px" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="Quantity" HeaderText="Quantity" DataField="Quantity"
                                    DataType="System.String" HeaderStyle-Width="75px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="EstCosts" HeaderText="Est $$$" DataField="EstCosts"
                                    DataType="System.Decimal" HeaderStyle-Width="50px">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <NoRecordsTemplate>
                                <p class="ExampleNoRecords">
                                    No Protocol Requests have been created.</p>
                            </NoRecordsTemplate>
                        </telerik:GridTableView>
                    </DetailTables>
                    <NoRecordsTemplate>
                        <p class="ExampleNoRecords">
                            No Details have been asscoiated with the Order.</p>
                    </NoRecordsTemplate>
                </telerik:GridTableView>
                <%-- Grid that is causing me problems --%>
                <telerik:GridTableView DataKeyNames="OrderNotesId" Name="OrderNotesLevel" Width="100%"
                    HierarchyDefaultExpanded="False" AllowPaging="false"
                    CellPadding="5" GridLines="None">
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn2">
                            <HeaderStyle Width="20px" />
                            <ItemStyle CssClass="MyImageButton" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridBoundColumn SortExpression="OrderNotesId" HeaderText="#"
                            DataField="OrderNotesId" DataType="System.String" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="ReportDate" HeaderText="Report Date" DataField="ReportDate"
                            DataFormatString="{0:d}" DataType="System.DateTime">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="OrderGoals" HeaderText="Goals"
                            DataField="OrderGoals" DataType="System.String">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <NoRecordsTemplate>
                        <p class="ExampleNoRecords">
                            No historical Action Steps have been created.</p>
                    </NoRecordsTemplate>
                    <EditFormSettings UserControlName="~/UserControls/OrderNotesEntry.ascx" EditFormType="WebUserControl">
                        <EditColumn UniqueName="EditCommandColumn1">
                        </EditColumn>
                    </EditFormSettings>
                </telerik:GridTableView>
            </DetailTables>
            <NoRecordsTemplate>
                <p class="ExampleNoRecords">
                    No Order Note data available.</p>
            </NoRecordsTemplate>
        </MasterTableView>
    </telerik:RadGrid>
</telerik:RadAjaxPanel>

ASPX EditForm UserControl:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="OrderNotesEntry.ascx.cs"
    Inherits="Usercontrols_OrderNotesEntry" %>
    <asp:Panel ID="pnlOrderNoteEntry" runat="server">
        <div class="OrderHighlight" style="visibility: hidden; display: none;">
            Id:
            <asp:Label ID="lblOrderNoteId" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.OrderNoteId" ) %>' /></asp:Label>
        </div>
        <div class="OrderHighlight">
            <table style="text-align: left;" width="99%">
                <tr>
                    <th class="DDSubHeader" style="width:150px;">
                        Date:
                    </th>
                    <td>
                        <telerik:RadDatePicker ID="rdpDate" runat="server" ZIndex="30001" DateInput-DateFormat="MM/dd/yyyy"
                            DbSelectedDate='<%# DataBinder.Eval( Container, "DataItem.OrderDate" ) %>' />
                    </td>
                    <th class="DDSubHeader" style="width:150px;">
                        Next Report Date:
                    </th>
                    <td>
                        <asp:RadioButtonList ID="rblNextOrderDate" RepeatDirection="Horizontal" runat="server"
                            RepeatColumns="4" OnDataBound="rblNextOrderDate_DataBound">
                        </asp:RadioButtonList>
                        <telerik:RadDatePicker ID="rdpNextDate" runat="server" ZIndex="30001" DateInput-DateFormat="MM/dd/yyyy"
                            DbSelectedDate='<%# DataBinder.Eval( Container, "DataItem.NextOrderDate" ) %>' />
                    </td>
                </tr>
            </table>
        </div>
        <br />
        <div class="OrderHighlight">
            Goals:
            <telerik:RadTextBox ID="rtbManagementGoals" runat="server" TextMode="MultiLine" Width="99%"
                Height="60px" Text='<%# DataBinder.Eval( Container, "DataItem.OrderGoals" ) %>'
                MaxLength="500">
            </telerik:RadTextBox>
        </div>
        <asp:Button ID="btnUpdate" Text="Update" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'>
        </asp:Button>
        <asp:Button ID="btnInsert" Text="Insert" runat="server" CommandName="PerformInsert"
            Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'></asp:Button>
          
        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
            CommandName="Cancel"></asp:Button>
    </asp:Panel>

User Control Code Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class Usercontrols_OrderNotesEntry : System.Web.UI.UserControl
{
    private object _dataItem = null;
    public object DataItem
    {
        get
        {
            return this._dataItem;
        }
        set
        {
            this._dataItem = value;
        }
    }
 
    private Dictionary<string, int> DateRanges()
    {
        Dictionary<string, int> dict = new Dictionary<string, int>();
        dict.Add("Custom", -1);
        dict.Add("30", 30);
        dict.Add("60", 60);
        dict.Add("90", 90);
        return dict;
    }
 
    protected void Page_Init(object sender, EventArgs e)
    {
        this.DataBinding += new System.EventHandler(this.OrderNotesEntry_DataBinding);
    }
 
    protected void OrderNotesEntry_DataBinding(object sender, System.EventArgs e)
    {
        Dictionary<string, int> dict = DateRanges();
 
        rblNextReportDate.DataSource = dict;
        rblNextReportDate.DataTextField = "Key";
        rblNextReportDate.DataValueField = "Value";
        rblNextReportDate.DataBind();
    }
     
    protected void Page_Load(object sender, EventArgs e)
    {
    }
 
    protected void rblNextReportDate_DataBound(object sender, EventArgs e)
    {
        RadioButtonList rbl = sender as RadioButtonList;
        foreach (ListItem li in rbl.Items)
        {
            li.Attributes.Add("onclick", string.Format("javascript:pds('{0}', '{1}')", rbl.ClientID, li.Value));
        }
    }
}
Johnathan
Top achievements
Rank 1
 answered on 18 Apr 2012
11 answers
435 views
hello,

we're currently getting the selected date through the client object (javascript) and passing them through jQuery ajax.

var theDate = $find('<%= radDatePicker1.ClientID %>').get_selectedDate();
$.ajax({data: JSON.stringify({ dateIn : theDate })});

[WebMethod()]
public void GetDateSelected(DateTime? dateIn)
{
    // do something
}

Our servers are currently in Arizona (GMT -7) and pacific time users doesn't experience the issue. If a client from a Mountain Timezone accesses the datepicker, the control increments 1 day to the selected date. Is there any way to prevent this?
Tom
Top achievements
Rank 1
 answered on 18 Apr 2012
0 answers
59 views
Hi,

I have a Nested radgrid (master & DetailTable) ...when using export to excel i want to display the detailTable cell values using offset 0,2 .
that means i want to shif the cell position by 2 and merge the detail table headers with the master
i'm using

ExcelMLExportRowCreated  & ExcelMLExportRowCreated

C#2.0, Telerik Rad Ajax Q3,2010

Exmaple:-
this is what i have
OrdID        Date        Amount
ord#1        Mar3                $80
                ITEM#      NAME              Amount
                Item#1    ItemName1        $50
                Item#2    ItemName2        $30

ord#2        Mar3               $100
                ITEM#      NAME              Amount
                Item#1    ItemName1        $45
                Item#2    ItemName2        $55

should be change to....
OrdID        Date     ITEM#    NAME            TotalAmount
ord#1        Mar3                                                $80
                            Item#1    ItemName1             $50
                            Item#2    ItemName2            $30
ord#2        Mar3                                               $100
                             Item#1    ItemName1           $45
                            Item#2    ItemName2            $55


  

Robert
Top achievements
Rank 1
 asked on 18 Apr 2012
3 answers
189 views
Dear all,

I'm following this demo : http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx
I can simulate this in a working environment. But the database is not updated, only the in memory datatable.

How can I update the real database?  Is there a method that can do or do you have working example that works directly on the SQLDatasource? 

Please help!

Koen

Elliott
Top achievements
Rank 2
 answered on 18 Apr 2012
1 answer
168 views
Hi ,
My page has the following feature.
when clicked on any grid on page A,it will take few values in form of query string and fetch records on Page B based one the search criteria in the query string.
Problem is I get the error during the dataBind of page load of Page B.

 

Here is my code of PAGE B
  
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
 gvSearchResults.EmptyDataText =  " ";
gvSearchResults.Columns[3].Visible = false;
gvSearchResults.Columns[4].Visible = false;
gvSearchResults.DataSource = null;
gvSearchResults.DataBind();
/** going to assume that the only mode passing in is search */
if (Request["mode"] != null)
{
if (Request[SearchConstants.PARM_BIZDT] != null)
{
string strDt = Request[SearchConstants.PARM_BIZDT];
try 
{
DateTime dt =
DateTime.ParseExact(strDt, SearchConstants.PARM_BIZDT_FORMAT, DateTimeFormatInfo.InvariantInfo);
StartDT.SelectedDate = dt;
EndDT.SelectedDate = dt;
}
catch (Exception ex)
{
log.Error(
"Unable to parse search parm session date", ex);
}
}
if (Request[SearchConstants.PARM_EXCHANGETYPE] != null)
ContractSelect.Exchange = Request[
SearchConstants.PARM_EXCHANGETYPE];//.Substring(0, 4); 
else 
ContractSelect.Exchange = "";
//if (Request[SearchConstants.PARM_COMMODITY] != null) 
//{ 
// string strCommodity = Request[SearchConstants.PARM_COMMODITY].ToString(); 
// ContractSelect.Commodity = strCommodity;//.Substring(0, 2); 
 //} 
//else 
// ContractSelect.Commodity = ""; 
if (Request[SearchConstants.PARM_YEAR] != null)
{
try 
{
if (Request[SearchConstants.PARM_YEAR].Length >= 4)
ContractSelect.SetYear = int.Parse(Request[SearchConstants.PARM_CONTRACT_YEAR]);
}
catch (Exception ex)
{ log.Error( "Invalid contract year passed in.", ex);
} }
else 
ContractSelect.SetYear = 0;
if (Request[SearchConstants.PARM_MONTH] != null)
{ try 
{ ContractSelect.SetMonth = 
int.Parse(Request[SearchConstants.PARM_MONTH]);
}
catch (Exception ex)
{log.Error( "Invalid contract month passed in.", ex);
}
}
else 
ContractSelect.SetMonth = 0;
if (Request[SearchConstants.PARM_NUM] != null)
{
string value=Request[SearchConstants.PARM_NUM];
try 
{
hidAccountNum.Value = value;
}
catch (Exception ex)
{cmbAccount.Items.Add(new RadComboBoxItem(value, value));
cmbAccount.SelectedValue = value;
}
}
string str = String.Format("setTimeout(\"{0}.ajaxRequest(\'SEARCH\')\", 250);", RadAjaxManager1.ClientID);
ClientScript.RegisterStartupScript(Page.GetType(),"StartSearch", str, true); }
else 
{
DateTime lastSession = service.GetLastTradeSession();
StartDT.SelectedDate = lastSession;
EndDT.SelectedDate = lastSession;
}
btnExportExcel.OnClientClick = 
string.Format(@"{0}.__doPostBack('{1}', '{2}'); return false;",
RadAjaxManager1.ClientID, btnExportExcel.UniqueID,
btnExportExcel.CommandArgument);
TypeSelect.TradeType = "";
DataBind();   //error is here.  
}

Please let me know if you require anything else to understand the issue.

Thanks,
Tarang

Jayesh Goyani
Top achievements
Rank 2
 answered on 18 Apr 2012
3 answers
80 views
Hi ,

I Recently upgraded my Telerik's DLLs from version  2010.3.1215.40  to  2012.1.215.40  version.
On successful upgrade of the Dll's I found below Properties are missing at the Asp.net Ajax RadGrid 2012.1.215.40 's  'GridSelecting'
class.

AllowCellSelect
AllowColumnSelect
AllowMultiCellSelect
AllowMultiColumnSelect

I would like to know whether these properties are removed intentionally or these provided some where else in the Latest Dll's.

Please comment on this.

Thanks,
Srinivas

 

 

Eyup
Telerik team
 answered on 18 Apr 2012
7 answers
156 views
Hi Dear telerik


when i use RadInput  with right to left text box, i have a bad problem: 
Warning icon is in the right side and this image conflict with text.
for this problem i used  this topic http://www.telerik.com/community/forums/aspnet-ajax/input/input-problem-with-right-to-left.aspx and my problem Solved.

when i Used  RadInput  with left to right text box for Numeric Entry Warning icon is in the left side and this image conflict with text.

i want warning icon is in Left Side and warning text is in right side for both of LTR and RTL

please Help me.

please see attached image : 
Eyup
Telerik team
 answered on 18 Apr 2012
1 answer
36 views
Hi,

In scheduler I'm loading big amount of events information via sqldatasource. And I need only for the user to choose a free slot and hit the button "book it" then he will be redirected to other page.I'm using custom InlineInsertTemplate. The problem is - that when clicking any free slot, all scheduler data gets repopulated it takes about 2-3 seconds to complete. Is it possible to load the data once and and void only InlineInsertTemplate without recreating all the slots? Thanks in advance
Peter
Telerik team
 answered on 18 Apr 2012
2 answers
208 views
Hi,

I have a radgrid whose css is defined in an external stylesheet. I am mainly looking for the height of the radgrid and the width of each of the columns.
The radgrid remains unaffected inspite of the css. I am adding the external style sheet on the server-side in the Page Load like this:
HtmlLink link = new HtmlLink();
                link.Attributes["href"] = "~/Styles/Grids.css";                
                link.Attributes.Add("type", "text/css");
                link.Attributes.Add("rel", "stylesheet");
                Page.Header.Controls.Add(link);

What am I doing wrong?
Pooja
Top achievements
Rank 1
 answered on 18 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?