Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
108 views
I have a set of columns which are not editable in 'Edit Mode'. But when on 'Insert Mode' I want the same columns to have dropdowns and I should be able to select values. In EditMode to disable these columns this is what I have done:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
       {
           if (e.Item is GridEditableItem && e.Item.IsInEditMode && !(e.Item is GridEditFormInsertItem))
           {
 
               GridEditableItem item = e.Item as GridEditableItem;
               GridEditManager manager = item.EditManager;
               //Adding columns that are not editable
               GridTextBoxColumnEditor editor = manager.GetColumnEditor("Description") as GridTextBoxColumnEditor;
               editor.TextBoxControl.Enabled = false;
               editor.TextBoxControl.BackColor = System.Drawing.Color.Gray;
               editor.TextBoxControl.ForeColor = System.Drawing.Color.Black;
               editor = manager.GetColumnEditor("SameRegion") as GridTextBoxColumnEditor;
               editor.TextBoxControl.Enabled = false;
               editor.TextBoxControl.BackColor = System.Drawing.Color.Gray;
               editor.TextBoxControl.ForeColor = System.Drawing.Color.Black;
               editor = manager.GetColumnEditor("AVRMName") as GridTextBoxColumnEditor;
               editor.TextBoxControl.Enabled = false;
               editor.TextBoxControl.BackColor = System.Drawing.Color.Gray;
               editor.TextBoxControl.ForeColor = System.Drawing.Color.Black;
               editor = manager.GetColumnEditor("AVRMZName") as GridTextBoxColumnEditor;
               editor.TextBoxControl.Enabled = false;
               editor.TextBoxControl.BackColor = System.Drawing.Color.Gray;
               editor.TextBoxControl.ForeColor = System.Drawing.Color.Black;
           }
                 
       }
The description and SameRegion columns should have a dropdown in 'InsertMode' so that I can pass the selected values. How can I achieve this?
RB
Top achievements
Rank 1
 answered on 02 Apr 2014
1 answer
339 views
Hi,

My requirement is to auto populate the textboxes(bound columns) in the insert form on selecting items from a radcombobox which is in the same insert form. My RadGrid is using Batch edit mode. I tried to attach the OnClientSelectedIndexChanged event for the RadCombobox. But after selecting the item and auto populating the TextBoxes(bound columns), the textboxes wont appear, it looks like labels.. The major issue is the OnClientSelectedIndexChanged is firing on the save button click. Please provide a solution for this.

ASPX:
01.<telerik:RadGrid ID="ad" runat="server" OnNeedDataSource="ad_NeedDataSource" AutoGenerateColumns="false">
02.    <MasterTableView EditMode="Batch" CommandItemDisplay="Top">
03.        <BatchEditingSettings EditType="Row" OpenEditingEvent="Click" />
04.        <Columns>
05.            <telerik:GridBoundColumn DataField="testProperty" UniqueName="testProperty" HeaderText="testProperty">
06.            </telerik:GridBoundColumn>
07.            <telerik:GridBoundColumn DataField="test" UniqueName="test" HeaderText="test">
08.            </telerik:GridBoundColumn>
09.            <telerik:GridBoundColumn DataField="description" UniqueName="description" HeaderText="description">
10.            </telerik:GridBoundColumn>
11.            <telerik:GridBoundColumn DataField="code" UniqueName="code" HeaderText="code">
12.            </telerik:GridBoundColumn>
13.            <telerik:GridTemplateColumn HeaderStyle-Width="300px" HeaderText="ShipCountry" UniqueName="ShipCountry"
14.                DataField="ShipCountry">
15.                <ItemTemplate>
16.                    <asp:Label ID="lb" runat="server" Text="jklm"></asp:Label>
17.                </ItemTemplate>
18.                <EditItemTemplate>
19.                    <telerik:RadComboBox runat="server" Skin="WebBlue" ID="RadComboBox1" Height="200px"
20.                        Width="270px" DropDownWidth="800px" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged"
21.                        ShowMoreResultsBox="true" EnableVirtualScrolling="true" ChangeTextOnKeyBoardNavigation="true">
22.                        <Items>
23.                            <telerik:RadComboBoxItem Text="gh1" Value="sdf1" />
24.                            <telerik:RadComboBoxItem Text="gh2" Value="sdf2" />
25.                            <telerik:RadComboBoxItem Text="gh3" Value="sdf34" />
26.                        </Items>
27.                    </telerik:RadComboBox>
28.                </EditItemTemplate>
29.            </telerik:GridTemplateColumn>
30.        </Columns>
31.    </MasterTableView>
32.</telerik:RadGrid>

Js:
1.<script type="text/javascript">
2.    function OnClientSelectedIndexChanged(sender, args) {
3.        alert("fired!!!!!!!!!");
4.    }
5.</script>

Thanks
Angel Petrov
Telerik team
 answered on 02 Apr 2014
4 answers
249 views
I have a RadGrid, with a RadFilter applied to it.   I am not using RadAjaxPanel or any Ajax controls.

When I execute a RadGrid.MasterTableView.ExportToCSV(),  I do not get any data returned when IgnorePaging = true.  

If I set IgnorePaging = false, I get exported data, but only the first page.

How do I get the full dataset of the grid when using RadFilter? 
Kostadin
Telerik team
 answered on 02 Apr 2014
2 answers
167 views
I have XML that is coming back from my database and I'm databinding it to my TreeView, but it shows:

System.Xml.XmlDeclaration
System.Xml.XmlElement

as part of my tree. 

Here is my XML:

<?xml version="1.0" encoding="utf-8" ?>
<tree>
  <node text="2014">
    <node text="Test 1">
      <node text="Test 2">
        <node text="Test 3" />
        <node text="Test 4" />
      </node>
    </node>
  </node>
  <node text="2013">
      <node text="Test 1">
        <node text="Test 2">
          <node text="Test 3" />
          <node text="Test 4" />
        </node>
      </node>
  </node>
</tree>

I need my tree to display it like this with checkboxes next to it.
2014
-Test 1
---Test 2
------Test 3
------Test 4
2013
-Test 1
---Test 2
------Test 3
------Test 4

Thank you for any help.
Boyan Dimitrov
Telerik team
 answered on 02 Apr 2014
1 answer
341 views
Hi,

this is my first post here so if I misplaced it then sorry.
I need advice in preventing errors caused by XSS (Cross-Site Scripting). Our client's security check discovered that RadGrid filters can be vulnerable to XSS. At least when you insert js into the value field of the filter control of the column and then chose a filter type it causes a unhandled exception. Is there some way to handle the exception? I know the filter controls are secured against sql injection but the error caused by XSS is irritating. Especially that on a client we only have js error and the "loading icon" of RadGrid is spinning. Is my assumption that if someone manages to circumvent the 500 error that a XSS attack could be succesful?
Is there any way to implement "Microsoft Anti-Cross Site Scripting Library" for this problem or some other solution?

Attempted js text in filter:
<script>alert(1)</script>
 
Error in VS2012:
Unhandled exception at line 6, column 84289 in http://localhost:52030/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:pl-PL:c9cbdec3-c810-4e87-846c-fb25a7c08002:ea597d4b:b25378d2;Telerik.Web.UI,+Version=2013.1.220.45,+Culture=neutral,+PublicKeyToken=121fae78165ba3d4:pl-PL:3e3b0da6-8c39-4d10-9111-25eaee1f7355:16e4e7cd:ed16cbdc:f7645509:86526ba7:874f8ea2:24ee1bba:e330518b:2003d0b8:1e771326:c8618e41:19620875:f46195d3:490a9d4e:bd8f85e4:58366029:8674cba1:7c926187:b7778d6c:c08e9f8a:aa288e2d:e4f8f289:59462f1:a51ee93e

0x800a139e - Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$rgridPromotions$ctl00$ctl02$ctl03$FilterTextBox_colName="<script>alert(1)</sc...").


Error in IE:
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Timestamp: Mon, 31 Mar 2014 09:12:18 UTC


Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Line: 6
Char: 84147
Code: 0
URI: http://crr-app1:10000/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3apl-PL%3a10a773fc-9022-49ec-acd6-8830962d8cbb%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2013.1.220.45%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3apl-PL%3a3e3b0da6-8c39-4d10-9111-25eaee1f7355%3a16e4e7cd%3aed16cbdc%3af7645509%3a86526ba7%3a874f8ea2%3a24ee1bba%3ae330518b%3a2003d0b8%3a1e771326%3ac8618e41%3a19620875%3af46195d3%3a490a9d4e%3abd8f85e4%3a58366029%3a8674cba1%3a7c926187%3ab7778d6c%3ac08e9f8a%3aaa288e2d%3ae4f8f289%3a59462f1%3aa51ee93e
Vasil
Telerik team
 answered on 02 Apr 2014
8 answers
300 views
Hi all!!
    Good Day!!!
    
    Am New Member for this community. Please help to me clarify my doubt in telerik controls.
    
    Now i need a graph report using rad chart control and export to excel and word or pdf.
    
    can anyone give a suggestion with example and explain....
Danail Vasilev
Telerik team
 answered on 02 Apr 2014
1 answer
189 views
Is there any demo for an autocomplete textbox without database  but with the possibility to add a list of  selected items and save those added by the users?
i would like to add this in a radgrid template form with a list of countries.

thanks,
Felice
Nencho
Telerik team
 answered on 02 Apr 2014
1 answer
294 views
Hi,

I have a Telerik Radgrid and I have a button. On click of the button, I try to export the content in the grid to an Excel file. PFB the code I have used for that.

​string alternateText = "ExcelML";
RadGrid1.ExportSettings.Excel.Format = (GridExcelExportFormat)Enum.Parse(typeof(GridExcelExportFormat), alternateText);
RadGrid1.ExportSettings.ExportOnlyData = true;
RadGrid1.ExportSettings.IgnorePaging = true;
RadGrid1.ExportSettings.OpenInNewWindow = true;
RadGrid1.MasterTableView.ExportToExcel();


I have debugged the code and it enters the loop, accesses every line of code and exits the loop with no exception. But the content is not exported to any excel. Please help ASAP
Princy
Top achievements
Rank 2
 answered on 02 Apr 2014
1 answer
315 views
Hi!

I´m building my grids (and its columns) dynamically using data from a database. This data includes information about the formatting and validation. To configure a grid easily I wrote some razor-extension-methods for the kendoUI-grid but now encounter some problems concerning configuration of kendoUI-grid.

1) To display a checkbox for bool-values I have to defined a clienttemplate like this:
boundColumn.ClientTemplate("<input .... />");
This is always shown independent of edit-mode or display-mode. To make it only visible I added the disabled-attribute. But how can I realize a switch to an editable checkbox for InCell/InLine-editing? 

2) Validation should be also configured by data from the database. E.g. the numeric-input: The grid creates automatically the numericTextBox - but how can I modify attributes like min, max or interval?

For both topics it is important to do these settings on the server-side!

Best Regards!
Vladimir Iliev
Telerik team
 answered on 02 Apr 2014
3 answers
210 views
I am using radsearchbox against a database of town or city names, and that works great.

I have an additional field in my database of 'alternative spellings' of these town names  (anglicised versions, ones without special accent characters, etc)

Is it possible to get my searchbox to match against not just the field specified in my datatextfield but against both fields?

Should I be using the DataSourceSelect server side event to modify the query?

Thanks
Plamen
Telerik team
 answered on 02 Apr 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?