Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
120 views
I have a RadGrid with 3 external filter controls: 1 textbox and 2 comboboxes. Things work well when the requested data from these controls is successfully returned by the GetData() query. However, if I try to return an incorrect value from one of the controls my app blows-up stating that I have no bindable data. How can I create a scenario from which it checks to see if my DataTable returns rows and if NOT, then display a pop-up message AND to not re-bind the RadGrid? Here is my current code ...
My controls include: RadGrid1, RadComboBox1, RadComboBox2, RadTextBox1, DataTable = myDataTable, DataRows = rows.

if (condition) {rows =...}
else if (condition) {rows = ...}               
else
{
return new DataTable();
}
                 
if (myDataTable.Rows.Count == 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "norowalert", "alert('I cannot complete your request.\nThere are no records that meet your criteria.');", true);
return new DataTable();
}
if (rows.Length == 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "norowalert", "alert('I cannot complete your request.\nThere are no records that meet your criteria.');", true);
return new DataTable();
                     
}
 
if (rows.Length >= 1)
{
return rows.CopyToDataTable();
RadGrid1.DataBind();
}
return rows.CopyToDataTable();
}
Alex
Top achievements
Rank 1
 answered on 02 Apr 2013
3 answers
117 views
I have a RadRibbonBar with a several RadDatePickers. RadDatePickers works well in IE, Chrome, but not in Firefox. Popup calendar is not showed even hover effect.

Thanks for advice

Ivana

My code (snip)

 

 

 

 

 

<telerik:RadRibbonBar ID="RadRibbonBar" runat="server" Skin="Telerik" OnClientSelectedTabChanged="onSelectedTabChanged">

 

 

 

 

 

 

 

<Tabs>

 

 

 

 

<

 

 

telerik:RibbonBarTab Text="Hotel - Sestavy">

 

 

 

<telerik:RibbonBarGroup Text="Filtr">

 

 

 

<Items>

 

 

 

<telerik:RibbonBarTemplateItem Width="340">

 

 

 

<asp:Table ID="Table7" runat="server">

 

 

 

<asp:TableRow ID="TableRow19" runat="server">

 

 

 

<asp:TableCell ID="TableCell37" runat="server">

 

 

 

<asp:Label ID="Label10" runat="server" Text="Kolej" />

 

 

 

</asp:TableCell><asp:TableCell ID="TableCell38" runat="server">

 

 

 

<asp:DropDownList ID="ddlResidenceSets" DataTextField="Nazev" DataValueField="Id"

 

 

 

runat="server" Width="80">

 

 

 

</asp:DropDownList>

 

 

 

<asp:CheckBox runat="server" Text="všechny" />

 

 

 

</asp:TableCell></asp:TableRow>

 

 

 

<asp:TableRow ID="TableRow20" runat="server">

 

 

 

<asp:TableCell ID="TableCell39" runat="server">

 

 

 

<asp:Label ID="Label11" runat="server" Text="Od" />

 

 

 

</asp:TableCell><asp:TableCell ID="TableCell40" runat="server">

 

 

 

<telerik:RadDatePicker ID="RadDatePicker4" runat="server" Width="120" Skin="Telerik" >

 

 

 

<DatePopupButton ToolTip="Otevře kalendář" /></telerik:RadDatePicker>

 

 

 

<asp:Label ID="Label12" runat="server" Text="do" />

 

 

 

<telerik:RadDatePicker ID="RadDatePicker5" runat="server" Width="120" Skin="Telerik" >

 

 

 

<DatePopupButton ToolTip="Otevře kalendář" /></telerik:RadDatePicker>

 

 

 

</asp:TableCell></asp:TableRow>

 

 

 

</asp:Table>

 

 

 

</telerik:RibbonBarTemplateItem>

 

 

 

</Items>

 

 

 

</telerik:RibbonBarGroup>

 

</

 

 

telerik:RibbonBarTab>

 

 

 

</Tabs>

 

 

 

</telerik:RadRibbonBar>

 

Angel Petrov
Telerik team
 answered on 02 Apr 2013
2 answers
201 views
I have an export button that when clicked, retrieves the date set in two RadDatePickers and then exports the results of all incidents between those two dates. I also have a label that is empty if the export is successful or will display "Error: Query too large to export" if the query is too large to export to excel (this is all in a try/catch statement).  

I have 2 issues. The first is concerning the error. The label was not being updated so I placed the label change in the try statement before the ExportToExcel method just to see if it was working. If I comment out the RadGrid.MasterTableView.ExportToExcel() line, it works perfectly. However, with this line, it won't work. By won't work, I mean the export works perfectly fine but the label is never updated. Also the try/catch statement does not work at all and I wonder if that is due to the same problem.

The second issue, is that ExportToExcel() used to export to Excel 2003 while ExportToExcel2007() obviously used to export to Excel 2007. Now, ExportToExcel2007() is deprecated. Limiting the query is not an option for our system. Is there a way to export to Excel 2007? I tried using ExportToExcel() in hopes that since the two methods were combined, it would export to the latest version but it is still exporting to 2003 with a .xls extension.

If someone could help solve these two problems that would be extremely helpful!
Thanks in advance!
Emily

Update:
On further inspection of the first issue, I have found the following code in a javascript file:

function

 

pnlRequestStarted(ajaxPanel, eventArgs)

 

{

 

    if(eventArgs.EventTarget.indexOf("btnExport") != -1)

 

    {

        eventArgs.EnableAjax =

false;

 

    }

 

 

}

The problem is, I need to set this back to true I believe in order to update the label and allow the try/catch statement to function properly. Any ideas? Thanks!

Emily
Top achievements
Rank 1
 answered on 02 Apr 2013
5 answers
134 views
Example dataset:

Company Material Collected
A Stone 1
A Wood 0
A Marble 1
A Plastic 1
B Stone 0
B Wood 0
B Marble 0
B Plastic 1
C Stone 1
C Wood 1
C Marble 1
C Plastic 1

Is it possible to show "Yes" for 1 and "No" for 0 while still retaining aggregate functionality?  Basically, the aggregate should be a sum which is a count of "Yes".
Daniel
Telerik team
 answered on 02 Apr 2013
5 answers
125 views
Hi,

My problem is when i select some text in design view and goes into html view, cursor not comes at selected text, cursor always comes at top of content so i can't identify my where is text located in html view because there are lot of content in html, so how can i set cursor on selected text when move from design view to html view.

Thanks,
Rumen
Telerik team
 answered on 02 Apr 2013
4 answers
315 views
Is there any easy way to center (both horizontally and vertically) a NoRecordsTemplate within the body of the RadGrid when using:

<ClientSettings EnableRowHoverStyle="true">
  <Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>
  <Selecting AllowRowSelect="true"></Selecting>
</ClientSettings>

on a RadGrid that has a height of 100%?
Xorcist
Top achievements
Rank 1
 answered on 02 Apr 2013
1 answer
156 views
Hi

This is my first use of thiscontrol and this is my second problem with it breaking  I have another un resolve post.

I have a panel with a Radgrid. If I have the following ClientSetting on the grid, the panels stop working.

Any Ideas
<ClientSettings>

 

 

<ClientEvents OnRowDeselected="onRowDeselected" />

 

</ClientSettings>

Andy

Kate
Telerik team
 answered on 02 Apr 2013
2 answers
209 views
I've constructed a simple AJAX-enabled web page with this code:

<%@ Page Language="C#" MasterPageFile="~/main.master" AutoEventWireup="true" Inherits="taskChecker" Codebehind="taskChecker.aspx.cs" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  <script type="text/javascript">
    function contentPageLoad(sender, e) {
 
    }
  </script>
 
  <asp:HiddenField ID="divScrollInit" runat="server" />
 
  <div class="contentHeader">
    Task Checker
  </div>
 
  <div class="content1">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
        <div style="font-size:14px; font-weight:bold; margin-left:-100px; margin-top:-30px">
          <asp:RadioButtonList ID="radioButtonMode" runat="server" RepeatDirection="Horizontal" AutoPostBack="true" OnSelectedIndexChanged="radioButtonMode_IndexChanged" CellSpacing="30">
            <asp:ListItem Text="Display Task" Value="Display" />
            <asp:ListItem Text="Compare Tasks" Value="Compare" />
          </asp:RadioButtonList>
        </div>
 
        <asp:UpdateProgress ID="UpdateProgress1" runat="server" Visible="true">
          <ProgressTemplate>
            <div id="progress" class="progress3">
              <img src="../Images/Progress/indicator_big.gif" />
              <br /><br />
              Please Wait
            </div>
          </ProgressTemplate>
        </asp:UpdateProgress>
 
        <asp:Panel ID="panelMain" runat="server" Visible="false" style="margin-left:-50px; margin-bottom:30px">
          <div class="titleBlack" style="padding-bottom:10px">
            <asp:Label ID="labelInstructions" runat="server" />
          </div>
 
          <div id="divTaskListGrid1" style="overflow-x:hidden; overflow-y:auto; width:705px; max-height:200px; border:1px solid black">
            <telerik:RadGrid ID="radGridTaskList" runat="server" AutoGenerateColumns="false" AllowSorting="true" Width="687px"
                              BorderColor="#E7E7FF" BorderStyle="Solid" BorderWidth="1" CellPadding="0" GridLines="Both" OnSelectedIndexChanged="radGridTaskList_SelectedIndexChanged">
              <HeaderStyle Font-Bold="true" ForeColor="#031d5b" VerticalAlign="Middle" Height="20" CssClass="pointerOnly headerGrid" />
              <ItemStyle CssClass="radGridItem" />
              <AlternatingItemStyle CssClass="radGridAltItem" />
              <ClientSettings EnablePostBackOnRowClick="true" EnableRowHoverStyle="true" Selecting-AllowRowSelect="true" />
          
              <MasterTableView BorderWidth="0" DataKeyNames="TaskID,TaskLevel">
                <Columns>
                  <telerik:GridBoundColumn DataField="TaskId" HeaderText="Task Id" SortExpression="TaskId" ItemStyle-HorizontalAlign="Center">
                    <HeaderStyle Width="55px" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                  </telerik:GridBoundColumn>
                 
                  <telerik:GridBoundColumn DataField="TaskNumber" HeaderText="Task #" SortExpression="TaskNumber" ItemStyle-HorizontalAlign="Center">
                    <HeaderStyle Width="40px" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Right" CssClass="indentRight20" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridBoundColumn DataField="TaskDate" HeaderText="Date" SortExpression="TaskDate" DataFormatString="{0:MMM yyyy}">
                    <HeaderStyle HorizontalAlign="Center" Width="60px" />
                    <ItemStyle HorizontalAlign="Center" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridTemplateColumn HeaderText="Mine">
                    <HeaderStyle HorizontalAlign="Center" Width="50px" />
                    <ItemStyle HorizontalAlign="Center" />
                    <ItemTemplate>
                      <%# GetMine(Convert.ToInt32(Eval("TaskLevel"))) %>
                    </ItemTemplate>
                  </telerik:GridTemplateColumn>
 
                  <telerik:GridTemplateColumn HeaderText="Contract">
                    <HeaderStyle HorizontalAlign="Center" Width="60px" />
                    <ItemStyle HorizontalAlign="Center" />
                    <ItemTemplate>
                      <%# GetContract(Convert.ToInt32(Eval("TaskLevel"))) %>
                    </ItemTemplate>
                  </telerik:GridTemplateColumn>
                 
                  <telerik:GridBoundColumn DataField="TaskDescription" HeaderText="Description" SortExpression="TaskDescription" ReadOnly="True">
                    <HeaderStyle HorizontalAlign="Left" />
                    <ItemStyle Wrap="true" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridBoundColumn DataField="TaskStdHours" HeaderText="Std Hrs" SortExpression="TaskStdHours" ItemStyle-HorizontalAlign="Center">
                    <HeaderStyle Width="60px" HorizontalAlign="Center" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridTemplateColumn HeaderStyle-Width="60px" HeaderText="Completed" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                      <asp:Label ID="labelCompleted" runat="server" Text='<%# Convert.ToBoolean(Eval("TaskStatus")) ? "Yes" : "No" %>' />
                    </ItemTemplate>
                  </telerik:GridTemplateColumn>
                </Columns>
              </MasterTableView>     
            </telerik:RadGrid>
          </div>
 
          <div id="divTaskListGrid2" runat="server" style="overflow-x:hidden; overflow-y:auto; width:705px; max-height:200px; border:1px solid black; margin-top:25px">
            <telerik:RadGrid ID="radGridTaskList2" runat="server" AutoGenerateColumns="false" AllowSorting="true" Width="687px"
                              BorderColor="#E7E7FF" BorderStyle="Solid" BorderWidth="1" CellPadding="0" GridLines="Both" OnSelectedIndexChanged="radGridTaskList2_SelectedIndexChanged">
              <HeaderStyle Font-Bold="true" ForeColor="#031d5b" VerticalAlign="Middle" Height="20" CssClass="pointerOnly headerGrid2" />
              <ItemStyle CssClass="radGridItem" />
              <AlternatingItemStyle CssClass="radGridAltItem" />
              <ClientSettings EnablePostBackOnRowClick="true" EnableRowHoverStyle="true" Selecting-AllowRowSelect="true" />
          
              <MasterTableView BorderWidth="0" DataKeyNames="TaskID,TaskLevel">
                <Columns>
                  <telerik:GridBoundColumn DataField="TaskId" HeaderText="Task Id" SortExpression="TaskId" ItemStyle-HorizontalAlign="Center">
                    <HeaderStyle Width="55px" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" />
                  </telerik:GridBoundColumn>
                 
                  <telerik:GridBoundColumn DataField="TaskNumber" HeaderText="Task #" SortExpression="TaskNumber" ItemStyle-HorizontalAlign="Center">
                    <HeaderStyle Width="40px" HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Right" CssClass="indentRight20" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridBoundColumn DataField="TaskDate" HeaderText="Date" SortExpression="TaskDate" DataFormatString="{0:MMM yyyy}">
                    <HeaderStyle HorizontalAlign="Center" Width="60px" />
                    <ItemStyle HorizontalAlign="Center" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridTemplateColumn HeaderText="Mine">
                    <HeaderStyle HorizontalAlign="Center" Width="50px" />
                    <ItemStyle HorizontalAlign="Center" />
                    <ItemTemplate>
                      <%# GetMine(Convert.ToInt32(Eval("TaskLevel"))) %>
                    </ItemTemplate>
                  </telerik:GridTemplateColumn>
 
                  <telerik:GridTemplateColumn HeaderText="Contract">
                    <HeaderStyle HorizontalAlign="Center" Width="60px" />
                    <ItemStyle HorizontalAlign="Center" />
                    <ItemTemplate>
                      <%# GetContract(Convert.ToInt32(Eval("TaskLevel"))) %>
                    </ItemTemplate>
                  </telerik:GridTemplateColumn>
                 
                  <telerik:GridBoundColumn DataField="TaskDescription" HeaderText="Description" SortExpression="TaskDescription" ReadOnly="True">
                    <HeaderStyle HorizontalAlign="Left" />
                    <ItemStyle Wrap="true" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridBoundColumn DataField="TaskStdHours" HeaderText="Std Hrs" SortExpression="TaskStdHours" ItemStyle-HorizontalAlign="Center">
                    <HeaderStyle Width="60px" HorizontalAlign="Center" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridTemplateColumn HeaderStyle-Width="60px" HeaderText="Completed" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                      <asp:Label ID="labelCompleted" runat="server" Text='<%# Convert.ToBoolean(Eval("TaskStatus")) ? "Yes" : "No" %>' />
                    </ItemTemplate>
                  </telerik:GridTemplateColumn>
                </Columns>
              </MasterTableView>     
            </telerik:RadGrid>
          </div>
 
          <div style="padding-top:20px">
            <asp:Button ID="buttonSubmit" runat="server" OnClick="buttonSubmit_Click" />
          </div>
        </asp:Panel>
      </ContentTemplate>
    </asp:UpdatePanel>
 
    <telerik:RadWindow ID="rwResults" runat="server" Behaviors="Close,Move" EnableShadow="true" VisibleStatusbar="false" VisibleTitlebar="true" AutoSize="true" Modal="true" >
      <ContentTemplate>
        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
          <ContentTemplate>
            <telerik:RadGrid ID="radGridResults" runat="server" AutoGenerateColumns="false" AllowSorting="true" Width="600" Height="400"
                              BorderColor="#E7E7FF" BorderStyle="Solid" BorderWidth="1" CellPadding="0" GridLines="Both">
              <HeaderStyle Font-Bold="true" ForeColor="#031d5b" VerticalAlign="Middle" Height="20" CssClass="pointerOnly headerGrid" />
              <ItemStyle CssClass="radGridItem" />
              <AlternatingItemStyle CssClass="radGridAltItem" />
          
              <MasterTableView>
                <Columns>
                  <telerik:GridBoundColumn DataField="TableName" Visible="false" />
                 
                  <telerik:GridBoundColumn DataField="FieldName" HeaderText="Field" ItemStyle-HorizontalAlign="Left">
                    <HeaderStyle Width="80px" HorizontalAlign="Left" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridBoundColumn DataField="Value1">
                    <HeaderStyle HorizontalAlign="Center" Width="60px" BackColor="#bcd0fe" />
                    <ItemStyle HorizontalAlign="Center" />
                  </telerik:GridBoundColumn>
 
                  <telerik:GridBoundColumn DataField="Value2">
                    <HeaderStyle HorizontalAlign="Center" Width="60px" BackColor="#d6bcfe" />
                    <ItemStyle HorizontalAlign="Center" />
                  </telerik:GridBoundColumn>
 
    <%--              <telerik:GridImageColumn>
                    <HeaderStyle HorizontalAlign="Center" Width="30px" />
                  </telerik:GridImageColumn>--%>
                </Columns>
              </MasterTableView>     
            </telerik:RadGrid>
          </ContentTemplate>
        </asp:UpdatePanel>
      </ContentTemplate>
    </telerik:RadWindow>
  </div>
 
  <div class="subtleMsg">
    <div id="msg" />
  </div>
</asp:Content>

Attached is a screenshot of one of the two modes of the page.  In this simpler mode, the user picks an item from a grid and presses "Display Task".  That causes a RadWindow to be opened which contains a summary grid displaying associated data for this item.

I spent several hours trying to get the RadGrid in the RadWindow to display.  It would not.  Only when I added an UpdatePanel in the RadWindow did it suddenly work.

Two questions:
  1. If the parent page has an UpdatePanel then why does the RadWindow need an UpdatePanel too?
  2. If #1 is always true then shouldn't your documentation include this fact?  For example, here it does not.

Sincerely,

Robert W.

Robert
Top achievements
Rank 1
 answered on 02 Apr 2013
3 answers
95 views
Hi

I would like to restrict entries of certain characters into a numeric text box, and I am doing it by handling the clientside Keypress event and cancelling the event in the JS function if the keypressed was one that I do not want to allow. This works great and user cannot type in the disallowed characters. (I am restricting the negative sign and the decimal point sign - see code snippet below).

Question I have is when users press a disallowed character, I would like the numeric text box to display the same visual effect as it does when users type in say an alphabet (which is not allowed on the numeric textbox).
In the case of typing in alphabets, the input box gets a red border and an image of a yellow triangle with an '!' is displayed in the control.
How can I achieve  this UI effect when I filter out additional characters using custom javascript.

FYI - here's my JS handler that rejects the negative sign and decimal point.
_allowPositiveIntegersOnly = function (sender, args) {
  /* Cancel the keystroke if it is a negativesign or a decimal separator */
  var keyCharacter = args.get_keyCharacter();
  if (keyCharacter == sender.get_numberFormat().DecimalSeparator ||
      keyCharacter == sender.get_numberFormat().NegativeSign) {
    args.set_cancel(true);
  }
 
};


Thanks
Angel Petrov
Telerik team
 answered on 02 Apr 2013
13 answers
134 views
hello,

i have a few questions:
1. my flash file has a resource folder where it is stored.
how i can change the flash object so i will be able to add the "base" param to it
2. i want to add a "allowFullScreen=true" how do i do that?
3. is it possible to make the width and height to be working with percentages?

thank you
Rumen
Telerik team
 answered on 02 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?