Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
149 views
Hi,

I'm trying to insert/update values in an XML file using XMLDataSource and RadGrid. Below is my code :

aspx
<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" DataSourceID="XmlDataSource1"
        GridLines="None">
        <MasterTableView AutoGenerateColumns="False" DataSourceID="XmlDataSource1" EditMode="InPlace"
            CommandItemDisplay="Bottom" InsertItemDisplay="Bottom">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                    <ItemStyle CssClass="MyImageButton" />
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn DataField="ruleset_id" FilterControlAltText="Filter ruleset_id column"
                    HeaderText="ruleset_id" SortExpression="ruleset_id" UniqueName="ruleset_id">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn DataField="list_code" FilterControlAltText="Filter list_code column"
                    HeaderText="list_code" SortExpression="list_code" UniqueName="list_code">
                    <EditItemTemplate>
                        <telerik:RadComboBox ID="ListCodeComboBox" runat="server" SelectedValue='<%# Bind("list_code") %>'>
                            <Items>
                                <telerik:RadComboBoxItem Text="BA001" Value="BA001" />
                                <telerik:RadComboBoxItem Text="BA002" Value="BA002" />
                                <telerik:RadComboBoxItem Text="BA003" Value="BA003" />
                            </Items>
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="list_codeLabel" runat="server" Text='<%# Eval("list_code") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="seq_no" FilterControlAltText="Filter seq_no column"
                    HeaderText="seq_no" SortExpression="seq_no" UniqueName="seq_no">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="new_field_name" FilterControlAltText="Filter new_field_name column"
                    HeaderText="new_field_name" SortExpression="new_field_name" UniqueName="new_field_name">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn DataField="field_name" FilterControlAltText="Filter field_name column"
                    HeaderText="Field Name" SortExpression="field_name" UniqueName="field_name">
                    <EditItemTemplate>
                        <telerik:RadComboBox ID="FieldNameComboBox" runat="server" DataSourceID="XmlDataSource2"
                            DataTextField="field_name" DataValueField="field_length" AppendDataBoundItems="True">
                            <Items>
                                <telerik:RadComboBoxItem Text="Select" Value="" />
                            </Items>
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="field_nameLabel" runat="server" Text='<%# Eval("field_name") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="concat_constant_value" FilterControlAltText="Filter concat_constant_value column"
                    HeaderText="concat_constant_value" SortExpression="concat_constant_value" UniqueName="concat_constant_value">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="concat_substring_start_pos" FilterControlAltText="Filter concat_substring_start_pos column"
                    HeaderText="concat_substring_start_pos" SortExpression="concat_substring_start_pos"
                    UniqueName="concat_substring_start_pos">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="concat_substring_end_pos" FilterControlAltText="Filter concat_substring_end_pos column"
                    HeaderText="concat_substring_end_pos" SortExpression="concat_substring_end_pos"
                    UniqueName="concat_substring_end_pos">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>
    <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="C:\TEMP\CONCATENATION_DETAIL_TEMP.XML">
    </asp:XmlDataSource>
    <asp:XmlDataSource ID="XmlDataSource2" runat="server" DataFile="C:\TEMP\LAYOUT_FIELDS_TABLE.XML"
        TransformFile="C:\TEMP\LAYOUT_FIELDS_TABLE.XSL"></asp:XmlDataSource>

aspx.vb
Private Sub RadGrid1_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand
    Dim ht As Hashtable = New Hashtable()
    DirectCast(e.Item, GridDataInsertItem).ExtractValues(ht)
    Dim s As String = ""
    For Each entry In ht
        s = s + "Field Name : " + entry.Key.ToString() + " , Value : " + entry.Value + vbCrLf
    Next
    MsgBox(s)
End Sub

output:
Field Name : concat_substring_start_pos , Value : 7
Field Name : concat_constant_value , Value : 6
Field Name : seq_no , Value : 3
Field Name : list_code , Value : BA002
Field Name : ruleset_id , Value : 1
Field Name : concat_substring_end_pos , Value : 8
Field Name : new_field_name , Value : 4  


I'm encountering 2 issues :
1. Column 5 (field_name), which is a template column that uses RadComboBox for editing and is bound to another data source for fetching values, is not extracted into the Hashtable.
2. Values in the hashtable are not in ordered in the sequence of RadGrid columns.

Please suggest the solutions for these (Issue 1 is higher priority)

Thanks,
Nishant
Eyup
Telerik team
 answered on 26 Jul 2012
0 answers
298 views
Hi,
I am using a grid to display data, it dynamically creating GridBoundColumn. I use System.Web.HttpUtility.HtmlEncode to encode the text, and when retrieving the data i use System.Web.HttpUtility.HtmlDecode to decode the data and then rebind to grid. When displaying the data in grid, it render the html. how can i display the data as text.

thanks in advance
Jiju
Jiju
Top achievements
Rank 1
 asked on 26 Jul 2012
2 answers
105 views
Hi,
I need to modify the item texts of a radgrid's FilterMenu ( for example changing "Order by", "Contains" and "Does not contain" to something else)

My attempted solution is to add a RadMenuEventHandler  to the FilterMenu.ItemCreated event, so that when a filtermenu item is created, my method FilterMenu_ItemCreated will fire and replace the necessary texts.

However the FilterMenu_ItemCreated  method never fires. And I'm not sure why

 I've have previously been successful when using the same approach for modifying texts inthe HeaderContextMenu. I just added an event handler for the ItemCreatedEvent (like this: grid.HeaderContextMenu.ItemCreated += new RadMenuEventHandler(HeaderContextMenu_ItemCreated); ) and that worked perfectly fine. 

So I'm confused why the same approach doesn't work for the FilterMenu

Below is some code:
----------------------


This is basically how the grid is set up. The event handler is added on the last line
RadGrid grid = new RadGrid();      
grid.ID = "radgrid1";   
....
grid.MasterTableView.AllowFilteringByColumn = true;
grid.MasterTableView.EnableHeaderContextFilterMenu = true;
grid.HeaderContextMenu.ItemCreated += new RadMenuEventHandler(HeaderContextMenu_ItemCreated);
grid.FilterMenu.ItemCreated += new RadMenuEventHandler(FilterMenu_ItemCreated);

A simplified version of the method which should fire during the ItemCreated event.


void FilterMenu_ItemCreated(object sender, RadMenuEventArgs e)
        {
  
            string newHeader = RadGridHelper.GetLocalizedTextForFilterMenuItems(e.Item.Text);
            if (!String.IsNullOrEmpty(newHeader))
                e.Item.Text = newHeader;
    #if DEBUG
            LogUtil.Log(String.Format("GetLocalizedTextForFilterMenuItems {0}", e.Item.Text));
#endif
        }
 
public static string GetLocalizedTextForFilterMenuItems(string text)
        {
 
            switch (text)
            {
                case "Between": return "Mellan" ;
    }}

DrKawashima
Top achievements
Rank 1
 answered on 26 Jul 2012
1 answer
116 views
Hello dear telerik-team,

I have a problem with my NestedViewTemplate grids.

1) is it possible to select own parent row by code, if a row in a subgrid gets selected (OnRowSelected event of the subgrid)? If yes, how?
2) How to deselect all rows in all opened subgrids and select only the one which has been currently clicked (including point 1).
3) How can a subgrid access values of its own parent row?

Everthing must work client side, without any access to the server.

Is it possible?

Would like some information about it, anything I found to this topic in the form, doesnt match my needs.

Thanks a lot!
Adam
Eyup
Telerik team
 answered on 26 Jul 2012
4 answers
211 views
I am trying to allow my web application to support multiple file selection/uploads but cannot figure it out. Let me get into more detail, I am writing an application for real estate management and need to be able to upload hundreds of files at once. We were going to do this with Microsoft SQL Server Filestream and RADAsyncUpload. We have some additional fields that need to be filled for the photos also. We are writing this in Visual Basic and any help is appreciated.


Thank you,
Kris
Bozhidar
Telerik team
 answered on 26 Jul 2012
0 answers
106 views
Hi ,
       When i am trying to upload the big files i am getting  below are the screen shot .

I have Tried the following solutions

1.  Increase the time out  in WCF level ie in < binding>
2.  I have added this in the web.config  <httpRuntime maxRequestLength="102400" executionTimeout="3600" />

Please check the below screen shot

Mohan
Top achievements
Rank 1
 asked on 26 Jul 2012
4 answers
140 views
Hi,

About multiline radtextbox : Have you experienced some scenario where RadTextBox1.text server side is more than 100 character long even if MaxLenght = 100 ?

I can't reproduced myself the problem but I had a couple of 'string or binary data would be truncated' while inserting in a nvarchar(100) sql server field.

I'm not using multiline very often and forgot to check server side the lenght of the text before inserting.

Anyway, I'm thinking about an old browser usage (IE6 ?) ?

What do you think ?

EDIT : using last telerik dll

Thanks
Arnaud


arnaud
Top achievements
Rank 1
 answered on 26 Jul 2012
1 answer
138 views
Hello,

I am implementing RadWindow in a user control that will pop up context sensitive help whenever the user clicks an icon.  The intention is that I will drop the user control anywhere on a page that requires it (i.e. multiple instances on the one page).

I have set up a hidden field on the user control so that each time it is dropped onto the page I can set the value of the field which is then used by the control to determine which help data to load.

The problem is that it seems the window the control uses is shared across all instances and it is unable to store the value independent of one another (therefore the same help text appears each time regardless of which help control is clicked).

Here is my Help Control code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Help.ascx.cs" Inherits="Controls_Generic_Help" %>
<script type="text/javascript">
    function openHelpWindow(sender, args) {          
        var radWindow = $find("<%=radWindow1.ClientID%>");
        var docId = $get("<%= documentIdField.ClientID%>").value;
        radWindow.setUrl("help.aspx?Id=" + docId);
        radWindow.show();
    }
</script>
<telerik:RadButton id="helpButton" runat="server" autopostback="false" Width="16" Height="16" onclientclicked="openHelpWindow">
    <Image EnableImageButton="true" ImageUrl="~/images/icon-help.png" IsBackgroundImage="false" />
</telerik:RadButton>
<telerik:radwindow id="radWindow1" runat="server" Width="600px" Height="600px" VisibleTitlebar="false"></telerik:radwindow>
<asp:HiddenField runat="server" ID="documentIdField" />


Then all I do on the page where the control is dropped is set the hidden field value:
Help1.HelpDocName = "HelpQuickLinksNavigator";
 
Help2.HelpDocName = "HelpActivityFeed";

However all that happens is that the first value only is used each time the window is opened.

Thoughts?

Andrew
Andrew Galea
Top achievements
Rank 1
 answered on 26 Jul 2012
1 answer
161 views
shfds
Kate
Telerik team
 answered on 26 Jul 2012
3 answers
125 views
As i click on a checkbox (template column) in a row of the main grid an event is raised and
a client-side function is called. 

Inside this function I need to do something on its detail table, I don't have, and I need it, the ID of that Detail Table
I did like this:

var grid = $find(gridClientID);
var childGridID = grid.get_detailTables()[ROW].get_dataItems()[0].get_id()

ROW is the index of the main grid row to which the checkbox belongs.

But... 
grid.get_detailTables()[index].get_dataItems()[0].get_id() 
index actually refer to the index of the expanded ones, so if click on the first row (ROW=0) and first row is not expanded and the second row is expanded the action takes place on the second row (ROW=1) because is the first expanded

How do I know
1) detail Table ID having the parent grid?
2) if it's not expanded can I work on it?

Thank you


Marin
Telerik team
 answered on 26 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?