Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
423 views
Urgent Help please,I am using databable as datasource,but RadGrid show "No records to display".
<
telerik:RadGrid ID="rgReportList" runat="server"  OnNeedDataSource="rgReportList_NeedDataSource" 
                    AllowSorting="True" AllowPaging="True"   ShowHeader="true" > 
                </telerik:RadGrid> 

 protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack) 
        { 
            rdpRequestDateStart.SelectedDate = DateTime.Now.AddMonths(-1); 
            rdpRequestDateEnd.SelectedDate = DateTime.Now; 
            rgReportList.DataSource = CreateDataSource("日期""按天统计", DateTime.Parse(DateTime.Now.Date.AddDays(-7).ToShortDateString()), DateTime.Parse(DateTime.Now.ToShortDateString())); 
            rgReportList.MasterTableView.DataBind(); 
            //rgReportList.MasterTableView.Rebind(); 
            //rgReportList.MasterTableView.HierarchyDefaultExpanded = true; 
            rgReportList.DataBind(); 
 
        } 
    } 



protected
 void rgReportList_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    { 
        rgReportList.DataSource = CreateDataSource("日期", ddltype.Value, (DateTime)rdpRequestDateStart.SelectedDate, (DateTime)rdpRequestDateEnd.SelectedDate); 
    } 
  private DataTable CreateDataSource(String categroy, String statisticType, DateTime startDay, DateTime endDay) 
    { 
        //DataSet dataset = new DataSet(); 
        DataTable dataTable = new DataTable(); 
        dataTable.TableName = "ReportByDate"
        dataTable.Columns.Add("时间"); 
        dataTable.Columns.Add("完成事件数"); 
        dataTable.Columns.Add("工时"); 
        dataTable.Columns.Add("处理中事件"); 
 
        //dataset.Tables.Add(dataTable); 
        for (DateTime dt =startDay; dt <= endDay; dt=dt.AddDays(1)) 
        { 
            UserRequestInfoCollection urList = UserRequest.List("", dt, dt.AddDays(1)); 
            Int32 totalThingsByEachDate = 0; 
            Int32 tsTotalWorkHours = 0; 
            Int32 totalNotFinishedThings = 0; 
            if (urList.Count!=0) 
            { 
                foreach (UserRequestInfo uri in urList) 
                { 
                    totalThingsByEachDate++; 
                    //tsTotalWorkHours+= ((TimeSpan)(uri.ExpectTime - uri.RequestTime)).Hours; 
                    if (!(Boolean)uri.IsClose) 
                    { 
                        totalNotFinishedThings++; 
                    } 
                 
                } 
           
             
            } 
            dataTable.Rows.Add(new String[] { dt.ToString(), totalThingsByEachDate.ToString(), tsTotalWorkHours.ToString(), totalNotFinishedThings.ToString() }); 
 
        } 
 
        return dataTable; 
    } 

Dimo
Telerik team
 answered on 20 Oct 2010
1 answer
126 views
When I use the javascript below on a regular page without panel bars, the code below works just fine.

var picker = $find("<%= datDueDate.ClientID %>");

picker.set_enabled(false);


However, when I use this code on a datepicker nested in radpanelbars, it does not work.  How can I enable/disable a datepicker that is nested in radpanelbars?

Thank you in advance.

Josh
Princy
Top achievements
Rank 2
 answered on 20 Oct 2010
5 answers
951 views
Is there a way to get a RadGrid to postback updates when a combo box inside the grid is changed -- preferably without leaving edit mode in the process?
Princy
Top achievements
Rank 2
 answered on 20 Oct 2010
1 answer
139 views
Radgrid don't bind after on need datasource. What do I do? 
We are not allowed to databind after on need data source.\
Any suggestions? Because my controls needs to be bind to the datasource and now its causing an error because
I put the method that fills my control with data in the onNeedDataSource and as I have said it's not Binding.
Thanks
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 20 Oct 2010
1 answer
161 views
Hi,

I have a requirement in which i am using filter with rad gird to query on multiple Share-Point lists. My question is to how to get the CAML query generated from the Filter expression if it is at all possible. Any broad line idea will be appreciated.
I know how to get the filter expression. so please don't direct me to that link.


Regards,
Govind.
Tsvetoslav
Telerik team
 answered on 19 Oct 2010
5 answers
363 views
I have a scenario where depending on the the values in a field of itemdata, I need to generate a different control. Obviously in ItemCreated the dataitem is not bound yet, but strangely if I add controls in ItemDataBound, they disappear by the time the control is rendered. For example:
If TypeOf (e.Item) Is RadListViewDataItem Then
    Dim FormItem As MyFormItem = CType(CType(e.Item, RadListViewDataItem).DataItem, MyFormItem)
    Select Case FormItem.TypeId
        Case "Header"
            Dim lbl As New Label
            lbl.Text = String.Format("<b>{0}</b>", FormItem.Text)
            e.Item.Controls.Add(lbl)
there the ItemTemplate is initially empty.

Is this possible?

Thanks,
Reuven
Reuven
Top achievements
Rank 1
 answered on 19 Oct 2010
2 answers
196 views
WEB.CONFIG
<httpRuntime maxRequestLength="2024000" executionTimeout="10000"/>
  
ASPX
<telerik:RadUpload runat="server" ID="RadUpload1" Skin="WebBlue" ControlObjectsVisibility="None" MaxFileInputsCount="1" ReadOnlyFileInputs="true"></telerik:RadUpload>                         

When I try uploading locally I could upload 50MB file. But when I tried from server upload stops in middle with an error

404 - File or directory not found.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

can anyone reply me on how to handle upload for large files.

Thanks,
Swetha

SWETHA MANDAVA
Top achievements
Rank 1
 answered on 19 Oct 2010
4 answers
425 views
I want to be able to set client side focus to the first field in a tab once the tab is clicked. I've tried the OnSelectedTab & OnSelectingTab client side events to run a js function, but when I click on one of the tabs, it doesn't get highlighted; nor does it go into my js function. If I take away the js event on the tabstrip, it works fine, but I can't set the focus to the first field. the last two tabs are optional and are disabled by default. They get enabled elsewhere in the code.

Here is my html:
<telerik:RadTabStrip ID="tsPatientDemographics" runat="server" AutoPostBack="false" OnSelectedTab="SetFocus"
                                            ScrollButtonsPosition="Right" MultiPageID="RadMultiPage1"
                                            BackColor="Gray" CausesValidation="False" Align="Left">


Here is my js:

            function SetFocus() {

                var tabStrip = $find("<%= tsPatientDemographics.ClientID %>");
                var selectedTab = tabStrip.get_selectedTab();
                var HospAcctno = document.getElementById("HospAcctno");
                var GuarRelToPat = document.getElementById("GuarRelToPat");
                var priInsCode = document.getElementById("priInsCode");
                var secInsCode = document.getElementById("secInsCode");
                var terInsCode = document.getElementById("terInsCode");

                if (selectedTab != null) {
                    var selectedTabValue = selectedTab.get_text();

                    if (selectedTabValue == "Patient") {
                        var HospAcctno = document.getElementById("HospAcctno");
                        HospAcctno.focus();
                    }
                    else if (selectedTabValue == "Guarantor") {
                        var GuarRelToPat = document.getElementById("GuarRelToPat");
                        GuarRelToPat.focus();
                    }
                    else if (selectedTabValue == "Pri Ins") {
                        var priInsCode = document.getElementById("priInsCode");
                        priInsCode.focus();
                    }
                    else if (selectedTabValue == "Sec Ins") {
                        var tabStrip = $find("<%= tsPatientDemographics.ClientID %>");
                        var tab = tabStrip.findTabByText("Sec Ins");
                        if (tab.get_isEnabled == true) {
                            var secInsCode = document.getElementById("secInsCode");
                            secInsCode.focus();
                        }
                    }
                    else if (selectedTabValue == "Ter Ins") {
                        var tabStrip = $find("<%= tsPatientDemographics.ClientID %>");
                        var tab = tabStrip.findTabByText("Ter Ins");
                        if (tab.get_isEnabled == true) {
                            var terInsCode = document.getElementById("terInsCode");
                            terInsCode.focus();
                        }
                    }
                }
            }

Bill
Top achievements
Rank 2
 answered on 19 Oct 2010
0 answers
135 views
Hello
I have a radgrid, there I have a nestedview with two-TAB controls and within
each tab a repeater control with a checkbox that tells me whether or not
selected an option from my database.
Since the option ItemCommand make it along the repeater and enable or disable the
options with the checkbox, my problem is how do I get each time
checkbox event access Oncheckedchangued return me the id code
grid and the repeater control to scroll it and store control
changes in my database.

I have an option that is to place a button and using the property commandname
ItemCommand capturing the event and do my validations and
routes, not if you have a more direct option to control
checkbox inside the repeater and nestedview.

Thanks

Alex Alfonso

Code ----------
<telerik:RadGrid ID="RadGridSedes" runat="server" AllowPaging="True" AllowSorting="True"
                    AutoGenerateColumns="False" GridLines="None" DataSourceID="OpenAccessDataSedes">
                    <ExportSettings ExportOnlyData="True">
                    </ExportSettings>
                    <MasterTableView DataKeyNames="CodigoSede" DataSourceID="OpenAccessDataSedes" CommandItemDisplay="TopAndBottom">
                        <CommandItemSettings AddNewRecordText="Adicionar Nuevo Registro" RefreshText="Actualizar" />
                        <RowIndicatorColumn Visible="True">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn Visible="True">
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn DataField="CodigoSede" DataType="System.Int32" HeaderText="Codigo Sede"
                                ReadOnly="True" SortExpression="CodigoSede" UniqueName="CodigoSede" Visible="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                                <HeaderStyle Width="30px" />
                            </telerik:GridClientSelectColumn>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="Editcommandcolumn">
                                <HeaderStyle Width="30px" />
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn DataField="Nombre" HeaderText="Nombre" SortExpression="Nombre"
                                UniqueName="Nombre">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Direccion" HeaderText="Direccion" SortExpression="Direccion"
                                UniqueName="Direccion">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Email" HeaderText="Email" SortExpression="Email"
                                UniqueName="Email">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Telefono1" HeaderText="Telefono1" SortExpression="Telefono1"
                                UniqueName="Telefono1">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Fax1" HeaderText="Fax1" SortExpression="Fax1"
                                UniqueName="Fax1">
                            </telerik:GridBoundColumn>
                        </Columns>
                        <EditFormSettings EditFormType="WebUserControl" UserControlName="AddEditSedes.ascx">
                        </EditFormSettings>
                        <NestedViewTemplate>
                            <div class="Centrado">
                                <telerik:RadTabStrip ID="RadTabStrip2" runat="server" SelectedIndex="0" MultiPageID="RadMultiPageSed">
                                    <Tabs>
                                        <telerik:RadTab runat="server" Text="Jornadas" ImageUrl="~/images/Jornadas.png">
                                        </telerik:RadTab>
                                        <telerik:RadTab runat="server" Text="Semestres" ImageUrl="~/images/Semestres.png">
                                        </telerik:RadTab>
                                    </Tabs>
                                </telerik:RadTabStrip>
                                <telerik:RadMultiPage ID="RadMultiPageSed" runat="server" Width="100%" SelectedIndex="0">
                                    <telerik:RadPageView ID="RadPageViewJornadas" runat="server">
                                        <telerik:OpenAccessDataSource ID="OpenAccessJornadas" runat="server" EnableDelete="False"
                                            EnableInsert="False" EnableUpdate="False" ObjectContextProvider="ServisistemasAra.FoxisWeb.TelerikOrm.AcademicoEntityDiagrams, ServisistemasAra.FoxisWeb.TelerikOrm"
                                            TypeName="ServisistemasAra.FoxisWeb.TelerikOrm.Jornadas" OrderBy="Descripcion"
                                            Where="">
                                        </telerik:OpenAccessDataSource>
                                        <asp:Repeater ID="JornadasList" runat="server" DataSourceID="OpenAccessJornadas">
                                            <ItemTemplate>
                                                <asp:CheckBox runat="server" ID="RoleCheckBoxJornadas" AutoPostBack="true" Text='<%# eval("descripcion") %>' OnCheckedChanged="JornadasCheckBox_CheckChanged" />
                                                <br />
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </telerik:RadPageView>
                                    <telerik:RadPageView ID="RadpageviewSem" runat="server">
                                        <div class="Centrado">
                                            <ul class="uledicion">
                                                <li>
                                                    <asp:Label runat="server" ID="LblSedeJornadaSemestre" CssClass="labelsedicion width130"
                                                        Text="Seleccione la jornada"></asp:Label>
                                                    <telerik:RadComboBox ID="ComboSedeJornadas" runat="server" Width="220px" DataTextField="Descripcion"
                                                        DataValueField="Codigo" AppendDataBoundItems="true" >
                                                        <Items>
                                                            <telerik:RadComboBoxItem runat="server" Text='<%$ Resources:General, SeleccioneOpcion %>'
                                                                Value="0" Selected="true" />
                                                        </Items>
                                                    </telerik:RadComboBox>
                                                    <asp:Button ID="ButConsulta" runat="server" Text="Consultar" CommandName="ConsultaSemestres" />
                                                </li>
                                            </ul>
                                            <asp:Repeater ID="RepeaterSedesJornadasSemestres" runat="server" DataSourceID="OpenAccessDataSemestres"
                                                Visible="false">
                                                <ItemTemplate>
                                                    <asp:CheckBox runat="server" ID="RoleCheckBoxSemestres" AutoPostBack="true" Text='<%# eval("descripcion") %>' OnCheckedChanged="SemestresCheckBox_CheckChanged"  />
                                                    <br />
                                                </ItemTemplate>
                                            </asp:Repeater>
                                        </div>
                                    </telerik:RadPageView>
                                </telerik:RadMultiPage>
                            </div>
                        </NestedViewTemplate>
                        <PagerStyle FirstPageToolTip="Primera Página" LastPageToolTip="Ultima Página" NextPagesToolTip="Siguientes Páginas"
                            NextPageToolTip="Siguiente Página" PagerTextFormat="Cambiar Página: {4} &nbsp;Página <strong>{0}</strong> de <strong>{1}</strong>, items <strong>{2}</strong> de <strong>{3}</strong> de <strong>{5}</strong>."
                            PrevPagesToolTip="Páginas anteriores" PrevPageToolTip="Página anterior" />
                    </MasterTableView>
                    <ClientSettings EnableRowHoverStyle="true">
                        <Selecting AllowRowSelect="True" />
                        <Resizing AllowRowResize="True" AllowColumnResize="True"></Resizing>
                    </ClientSettings>
                </telerik:RadGrid>

Code Behind to Itemcommand

Protected Sub RadGridSedes_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridSedes.ItemCommand
 
        If e.CommandName = RadGrid.ExpandCollapseCommandName Then
            If e.Item.Expanded = False Then
                'Es expandcollapseName
                Dim SedeId As String = e.Item.OwnerTableView.Items(e.Item.ItemIndex)("CodigoSede").Text
                Dim JornadasXSede As List(Of VJornadasBySedes)
                JornadasXSede = (From Sj In CachedScope.VJornadasBySedes() Where Sj.Sede = SedeId Select Sj).ToList
                If Not JornadasXSede Is Nothing Then
                    Dim Repeatlista As Repeater = DirectCast(e.Item, GridDataItem).ChildItem.FindControl("JornadasList")
                    For Each ri As RepeaterItem In Repeatlista.Items
                        ' Programmatically reference the CheckBox
                        Dim RoleCheckBox As CheckBox = TryCast(ri.FindControl("RoleCheckBoxJornadas"), CheckBox)
                        ' See if RoleCheckBox.Text is in selectedUsersRoles
                        Dim TmpRole = RoleCheckBox.Text
                        For Each SedesyJornadas As VJornadasBySedes In JornadasXSede
                            If SedesyJornadas.Descripcion = TmpRole Then
                                RoleCheckBox.Checked = True
                            End If
                        Next
                    Next
                End If
                'Adicionamos las jornadas en el combo
                Dim MisJornadasxsede = (From VJS In CachedScope.VJornadasBySedes() Where VJS.Sede = SedeId Select VJS).ToList()
                Dim CboSedesJornadas As RadComboBox = DirectCast(e.Item, GridDataItem).ChildItem.FindControl("ComboSedeJornadas")
                CboSedesJornadas.DataSource = MisJornadasxsede
                CboSedesJornadas.DataBind()
 
            End If
        End If
        If e.CommandName = "ConsultaSemestres" Then
            Dim nestedview As GridNestedViewItem = DirectCast(e.Item, GridNestedViewItem)
            Dim RadcboSede As RadComboBox = DirectCast(nestedview.FindControl("ComboSedeJornadas"), RadComboBox)
            Dim JornadaID As Integer = RadcboSede.SelectedValue
            Dim LSedesJornadasSemestres As List(Of VSemestresByJornadas)
            LSedesJornadasSemestres = (From Sj In CachedScope.VSemestresByJornadas() Where Sj.Jornada = JornadaID Select Sj).ToList
            If Not LSedesJornadasSemestres Is Nothing Then
                Dim RepeatSemestres As Repeater = DirectCast(nestedview.FindControl("RepeaterSedesJornadasSemestres"), Repeater)
                RepeatSemestres.Visible = True
                For Each ri As RepeaterItem In RepeatSemestres.Items
                    ' Programmatically reference the CheckBox
                    Dim SemestreCheckBox As CheckBox = TryCast(ri.FindControl("RoleCheckBoxSemestres"), CheckBox)
                    SemestreCheckBox.Checked = False
                    ' See if RoleCheckBox.Text is in selectedUsersRoles
                    Dim TmpSemestre = SemestreCheckBox.Text
                    For Each SemestresxJornadas As VSemestresByJornadas In LSedesJornadasSemestres
                        If SemestresxJornadas.Descripcion = TmpSemestre Then
                            SemestreCheckBox.Checked = True
                        End If
                    Next
                Next
            End If
        End If
    End Sub


Alex
Top achievements
Rank 1
 asked on 19 Oct 2010
4 answers
322 views
I have read that i need to exclude the export to excel and pdf buttons of the RadGrid from the AJAXified requests. I found the following article outlining this:

http://www.telerik.com/help/aspnet-ajax/ajxexclude.html

However i have two questions as this does not help me much:

1) When i add the OnRequestStart property to my ClientSettings  like this:
<ClientSettings AllowDragToGroup="True">
    <Scrolling AllowScroll="True" ScrollHeight="600px" UseStaticHeaders="True" />
    <ClientEvents OnRequestStart="gridRequestStart" />
</ClientSettings>

I get the following error: Type 'Telerik.Web.UI.GridClientEvents' does not have a public property named 'OnRequestStart'.

2) These buttons are generated by the Radgrid and i am unable to access them like the example shows...

Could someone help me to get this functionality working again? Thanks,
Duncan Evans
Top achievements
Rank 1
 answered on 19 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?