Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
195 views
Hi Guys,

Hope you can help me with this.

I got a Grid with a GridTemplateColumn and other informational columns, and inside the GridTemplateColumn is a ImageButton that will execute a function that will open documents. Here is the code:
Public Sub OpenDocument(ByVal sAttachmentPath As String)
    Dim sAttachmentExt As String
    Response.Clear()
    Response.ClearHeaders()
    Response.ClearContent()
    sAttachmentExt = sAttachmentPath.Substring(sAttachmentPath.LastIndexOf(CChar(".")))
    Try
        Select Case sAttachmentExt
            Case ".doc"
                Response.ContentType = "application/msword"
            Case ".docx"
                Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
            Case ".xls"
                Response.ContentType = "application/vnd.ms-excel"
            Case ".xlsx"
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            Case ".ppt"
                Response.ContentType = "application/vnd.ms-powerpoint"
            Case ".pptx"
                Response.ContentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
            Case ".pdf"
                Response.ContentType = "application/pdf"
            Case ".html"
                Response.ContentType = "application/html"
            Case ".txt"
                Response.ContentType = "application/plain"
            Case ".zip"
                Response.ContentType = "application/zip"
            Case ".rar"
                Response.ContentType = "application/rar"
            Case ".gif"
                Response.ContentType = "application/gif"
            Case ".jpg"
                Response.ContentType = "application/jpeg"
            Case ".png"
                Response.ContentType = "application/png"
            Case ".swf"
                Response.ContentType = "application/x-shockwave-flash"
            Case ".mpeg"
                Response.ContentType = "application/mpeg"
            Case ".avi"
                Response.ContentType = "application/x-msvideo"
            Case Else
                Response.ContentType = "application/plain"
        End Select
 
        Response.AddHeader("Content-Disposition", "attachment;filename=" & sAttachmentPath)
        Dim sourcefile As FileStream = New FileStream(sAttachmentPath, FileMode.Open)
 
        Dim FileSize As Integer
        FileSize = sourcefile.Length
        Dim getContent() As Byte = New Byte(FileSize - 1) {}
 
        sourcefile.Read(getContent, 0, CInt(sourcefile.Length))
        sourcefile.Close()
        Response.BinaryWrite(getContent)
        Response.Flush()
 
    Catch ex As Exception
        Throw ex
    Finally
        Response.End()
    End Try
End Sub

All work fine for the first time. But as soon I do a sorting of columns or filtering or change page, the Response.End() gives me an error of "Unable to evaluate expression". As a postback is made it start working again. Also I used HttpContext.Current.ApplicationInstance.CompleteRequest instead of Response.End() to see if continue working, in this case the error is not given, but still doesn't open the document. I know this is not a error of yours, but maybe there's something I could set to the grid to let me do what i need. Please let me know if you need any other information.

Thanks,
Josue
Veli
Telerik team
 answered on 27 Jan 2011
6 answers
108 views
Hi,

I have the collation of my database as CI_AI. While the query I use returns the expected records from db,
when they are returned in the radcombobox, the records listed are fewer. Whatever I do, the returned results are
somehow being filtered with accent sensitive properties.

Anyone seen this before?

Thank you
Francisco
Top achievements
Rank 1
 answered on 27 Jan 2011
3 answers
146 views
Hi

We're experiencing slow inital loads when using the RadScriptManager EnableScriptCombine feature if there is moderate load on the page. 

Why is the combining so slow? How can I speed it up? And why are other websites on the same server experiencing this slowdown aswell?
Page A under load, Page B with EnableScriptCombine enabled slows down.

I found the thread about disabling it and/or using a CDN. CDN isn't an option and disabling the combining results in ~20 more requests. 

Thanks
Simon
Telerik team
 answered on 27 Jan 2011
1 answer
448 views
When displaying, the RadComboBox is selecting the wrong font.

Configuration is:

<telerik:RadComboBox ID="radcomboboxRealEstateManager" runat="server" CssClass="mainFormInput" Skin="Telerik" Width="220px" DataTextField="Name"  DataValueField="UserID" Font-Names="Calibri, Arial, sans-serif">

In Firefox it displays per Formatting Issue image attached. In IE8 it falls back to the telerik style (see fontstyle inheritence image attached).

However, as can be seen in the fontstyle inheritance image, for some reason the RadComboBox control is rendering the Font-Names (to Styles="font-family") without the commas and spaces (which results in the odd output).

The version of the controls being used is 2010.2.713.35. I'd guess I'm likely to have to upgrade the controls (which is less than ideal as typically this causes all sorts of problems).

D
Kalina
Telerik team
 answered on 27 Jan 2011
2 answers
87 views
I use a tab strip created on demand with content in pageviews create on demand.
These pageviews contain some panels containing all controls created runtime and some  upload external pages.
I have to manage these edit controls created at runtime to click on a button, going to change the style of the textbox, but I can not handle it.

I can create as many pageviews their content created runtime all at once, or do I create content only event RadMultiPage1_PageViewCreated?
Help me please
Silvia
Luigi
Top achievements
Rank 1
 answered on 27 Jan 2011
1 answer
57 views
I have a RadGrid with a EditFormSettings/FormTemplate for editing specific records.   My dropdownlist is populating as expected, but my selectedvalue is not selecting the existing value.   Any help would be greatly appreciated.  Thanks.

protected void MyEditForm_DataBinding(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
            {
                  
                GridEditableItem gridEditItem = (GridEditableItem)e.Item;
                DropDownList dropDownList = (DropDownList)gridEditItem.FindControl("ContactMethod");
                dropDownList.DataSource = customerData.GetLookupList("ContactMethodList");
                dropDownList.DataBind();
                dropDownList.SelectedValue = gridEditItem.GetDataKeyValue("ContactMethodID").ToString();
            }
}

<asp:DropDownList ID="ContactMethod" runat="server" TabIndex="2" DataTextField="Display" DataValueField="LookupID" AppendDataBoundItems="true">
<asp:ListItem Text="" Value="0"></asp:ListItem>
 </asp:DropDownList>

In my MasterTableView, I have

DataKeyNames

 

 

="CaseId, ContactMethodID"

 

Karl Rohrbach
Top achievements
Rank 1
 answered on 27 Jan 2011
1 answer
58 views
Hi,

In the hierarchical grid, I have a form template(EditFormType="Template"). The CommandItemDisplay, shows add button. The Form Template is displayed when I click on add button. How can I display a radwindow instead of the Form Template (the template is for edit only).

Thank you.
Maria Ilieva
Telerik team
 answered on 27 Jan 2011
3 answers
126 views
I am trying to figure out how to best export a subset of data from a R.A.D. Grid. Specifically, I want to export only the selected items of the grid. It is a paged grid, non-hierarchical. If anyone knows a good way to do this, please let me know.
Daniel
Telerik team
 answered on 27 Jan 2011
1 answer
135 views
I am trying to implement the following sample: http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultvb.aspx

I would like this to work with just two DateTimePickers as the only two editable fields.

The problem I believe is the javascript 'GridCreated' function which uses the .onchange trigger of the textboxes. Since the DateTimePickers are a little complex they appear to have 3 inputs per picker.  The 'TrackChanges' doesnt seem to be firing at all.

Here is my code:

<form id="form1" runat="server">
   <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
       <Scripts>
           <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
           <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
           <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
       </Scripts>
   </telerik:RadScriptManager>
   <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="timesheetView">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="timesheetView" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
   </telerik:RadAjaxManager>
      
   <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="WebBlue">
   </telerik:RadSkinManager>
   <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"  
               Transparency="25" Width="75px">   
               <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'  
                   style="border: 0px;" />  
   </telerik:RadAjaxLoadingPanel>  
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      <script type="text/javascript">
          var hasChanges, inputs, dropdowns, editedRow;
          function RowClick(sender, eventArgs) {
              if (editedRow != null && hasChanges) {
                  if (confirm("Update changes?")) {
                      hasChanges = false;
                      $find("<%= timesheetView.MasterTableView.ClientID %>").updateItem(editedRow);
                  }
                  else {
                      hasChanges = false;
                  }
              }
          }
          function RowDblClick(sender, eventArgs) {
              if (editedRow && hasChanges) {
                  if (confirm("Update changes?")) {
                      hasChanges = false;
                      $find("<%= timesheetView.MasterTableView.ClientID %>").updateItem(editedRow);
                  }
                  else {
                      hasChanges = false;
                  }
              }
              editedRow = eventArgs.get_itemIndexHierarchical();
              $find("<%= timesheetView.MasterTableView.ClientID %>").editItem(editedRow);
          }
           function GridCreated(sender, eventArgs)
           {           
               var gridElement = sender.get_element();
               var elementsToUse = [];
               inputs = gridElement.getElementsByTagName("input");
               for (var i = 0; i < inputs.length;i++)
               {
                   var lowerType = inputs[i].type.toLowerCase();
                   if(lowerType == "hidden" || lowerType == "button")
                   {
                       continue;
                   }
                   var id = inputs[i].id; 
                          // This filters only the date time pickers
                   if ((id.indexOf("dateInput_text") != -1) == true) {
                       Array.add(elementsToUse, inputs[i]);
                       inputs[i].onchange = TrackChanges;
                       hasChanges = true;
                   }
               }
                 
               dropdowns = gridElement.getElementsByTagName("select");
               for (var i = 0; i < dropdowns.length;i++)
               {
                   dropdowns[i].onchange = TrackChanges;
               }
               setTimeout(function(){if(elementsToUse[0])elementsToUse[0].focus();},100);
           }
          function TrackChanges(e) {
              hasChanges = true;
          }
  </script>
  </telerik:RadCodeBlock>
   <div>
           <telerik:RadGrid Width="500px" ID="timesheetView" ShowStatusBar="True" AllowSorting="True" PageSize="7" GridLines="None" AllowPaging="True"
           runat="server" AutoGenerateColumns="false" EnableAJAX="True" EnableAJAXLoadingTemplate="True"     
               LoadingTemplateTransparency="25" AllowAutomaticUpdates="true" >      
            <MasterTableView AllowAutomaticUpdates="true" EditMode="InPlace">
              <Columns>
              <telerik:GridBoundColumn UniqueName="EventDate" DataField="EventDate" HeaderText="Date" ReadOnly="True" HeaderStyle-Width="25%" />
                <telerik:GridBoundColumn UniqueName="Location" DataField="Location" HeaderText="Location" ReadOnly="True" HeaderStyle-Width="25%" />
                <telerik:GridDateTimeColumn PickerType="TimePicker" UniqueName="InTime" DataType="System.DateTime" DataFormatString="{0:t}" DataField="InTime" HeaderText="In" ReadOnly="False" HeaderStyle-Width="25%" />
                <telerik:GridDateTimeColumn PickerType="TimePicker" UniqueName="OutTime" DataType="System.DateTime" DataFormatString="{0:t}" DataField="OutTime" HeaderText="Out" ReadOnly="False" HeaderStyle-Width="25%" />
      
              </Columns>
            </MasterTableView>
           <ClientSettings>
              <ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick"
                  OnGridCreated="GridCreated" />
          </ClientSettings>
   </telerik:RadGrid>
   </div>
   </form>

Code Behind: ( uses two classes that Im using as an ObjectDataSource)

Private Sub timesheetView_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles timesheetView.NeedDataSource
    Dim Timesheet As New Timesheet
    Timesheet.AddEntry("OFFICE ADMIN", DateTime.Now.AddHours(-1), DateTime.Now.AddHours(2))
    Timesheet.AddEntry("OFFICE XC", DateTime.Now.AddHours(-6), DateTime.Now.AddHours(3))
    Timesheet.AddEntry("OFFICE 9", DateTime.Now.AddHours(-4), DateTime.Now.AddHours(9))
    Timesheet.AddEntry("OFFICE 8", DateTime.Now.AddHours(-2), DateTime.Now.AddHours(7))
    timesheetView.DataSource = Timesheet.List
End Sub


How do I get GridDateTimeColumn to work in InPlace edit mode? I would possibly like to refresh the entire grid when the DateTimePicker has been changed.

Thankyou.

Serban.

Marin
Telerik team
 answered on 27 Jan 2011
1 answer
225 views
Hi,

I have a grid placed inside Div. I am displaying about 15 columns so when it goes long, Div displays Scrollbar to move right.
The problem is that somehow Grid displays a Vertical line exactly where Div's right border ends. I mean when we move scrollbar to right, it displays one Vertical line in between of column, as soon as we move scrollbar.

If I change my Div width to 1500 or more then grid fits inside Div so does not display this Vertical line but when div displays scrollbar and have to scroll to right, it displays a vertical line exactly from where scroll starts on right side.
But I cannot increase my Div width because of my screen size.
Please let me know what settings do I need to add for this?
Here is my code.
.Scrollgrid
        position: static; 
        OVERFLOW: scroll; border:2px; border-style:solid;
}        
.panelStyle
{
            width:100%;
}
  
                            <asp:Panel runat="server" ID="pnlOverview" CssClass="panelStyle">
                                <table width="100%">
                                    <tr align="center">
                                        <td>
  
  
                                            <div class="Scrollgrid" style="width: 1100px; height: 600px;">
                                                <telerik:RadGrid ID="RadGridAllRequests" runat="server" AllowPaging="true" AllowSorting="true"
                                                    AllowFilteringByColumn="true" AutoGenerateColumns="False" GridLines="Both" OnNeedDataSource="RadGridAllRequests_needdatasource"
                                                    OnItemDataBound="RadGridAllRequests_ItemDataBound" 
                                                    OnItemCreated="RadGridAllRequests_ItemCreated"
                                                    OnItemCommand="RadGridAllRequests_ItemCommand"
                                                    AllowMultiRowSelection="true" SelectedItemStyle-CssClass="SelectedItem" 
                                                       
                                                    Width="100%"
                                                    Skin="WebBlue">
                                                    <PagerStyle Mode="NextPrevNumericAndAdvanced" Position="TopAndBottom" AlwaysVisible="true" />
                                                    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
                                                        <Selecting AllowRowSelect="true" />
                                                    </ClientSettings>
                                                      
                                                    <MasterTableView ShowHeadersWhenNoRecords="true" 
                                                    AllowFilteringByColumn="true" DataKeyNames="RequestInfoID">
                                                        <Columns>
  
<!-- I am displaying about 15 columns here -->
  
                                                        </Columns>
                                                        <EditFormSettings>
                                                            <PopUpSettings ScrollBars="None" />
                                                        </EditFormSettings>
                                                        <ExpandCollapseColumn Resizable="False" Visible="False">
                                                            <HeaderStyle />
                                                        </ExpandCollapseColumn>
                                                        <RowIndicatorColumn Visible="False">
                                                            <HeaderStyle />
                                                        </RowIndicatorColumn>
                                                    </MasterTableView>
                                                </telerik:RadGrid>
                                            </div>
  
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>

Thanks in advance,
Nirav
Top achievements
Rank 1
 answered on 27 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?