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

I have a RadGrid with a MasterTableView and an inner GridTableView, as in master-detail samples. I want to enable sorting just on inner TableView.

When I click some column, an error shows up telling a field from detail object wasn't found on master object.

How can I address this?

TIA.

Rubens
Radoslav
Telerik team
 answered on 28 Sep 2011
1 answer
88 views
Hello
I have a radgrid in my form.
I also have a radiobutton that control if I want to see the radgrid or not
If Me.RBDestination.SelectedValue = 0 Then 'simple
          Me.TrMultiple.Visible = False
      ElseIf Me.RBDestination.SelectedValue = 1 Then 'multiple
          Me.TrMultiple.Visible = True
      End If
My radgrid is in the TrMultiple <tr>
On the page load I do
If Not IsPostBack = True Then
          RBDestination.SelectedValue = 0
          RBDestination_SelectedIndexChanged(Me, EventArgs.Empty)
  End If
 And my RadioButton looks like this:
<asp:RadioButtonList ID="RBDestination" runat="server" BorderColor="Black" BorderWidth="1" AutoPostBack="true">
            <asp:ListItem Value="0">Destination simple</asp:ListItem>
             <asp:ListItem Value="1">Destination multiple</asp:ListItem>
 </asp:RadioButtonList>
and my radgrid:
<tr id="TrMultiple" runat="server" >
       <td></td>
       <td>
              <telerik:RadGrid 
                   ID="RadGrid2" 
                   Skin="Vista" 
                   runat="server" 
                   ShowFooter="true" 
                  CommandItemStyle-HorizontalAlign="Center" Width="200px">  
                                   
                   <MasterTableView 
                        ShowFooter="true" 
                        CommandItemDisplay="bottom" 
                        EditMode="InPlace" >  
                       <CommandItemTemplate>
                              <asp:LinkButton ID="LinkButton1" CommandName="CalculDistance" Runat="server" CssClass="TexteBlanc16">Calculer</asp:LinkButton>
                       </CommandItemTemplate>
                      <Columns>                     
                           <telerik:GridTemplateColumn UniqueName="CodePostal" HeaderText="Destinations">  
                                 <ItemTemplate>  
                                      <asp:DropDownList ID="LstCodePostal" runat="server"></asp:DropDownList>
                                 </ItemTemplate>  
                          </telerik:GridTemplateColumn>  
                      </Columns>  
               </MasterTableView>  
                                     
     </telerik:RadGrid>

When I click on the radio button to put it visible (value = 1) then I see a little blue line as my radgrid seems to be empty. However, If in my page load I put the radiobutton value to 1, I see my radgrid as It should be..And after that, if I select the value 0 of my radio button and reselect the value 1 to make appear my grid, it shows my grid correctly.
It seems to happens only when I put the radgrid visible to false on page load...
how can i fix it?
Thank you
Princy
Top achievements
Rank 2
 answered on 28 Sep 2011
1 answer
159 views

Hi,

I am using pageview.contentUrl which creates an Iframe with the src attribute. How can I set an iframe ID from the codebehind.

Thanks
Shinu
Top achievements
Rank 2
 answered on 28 Sep 2011
1 answer
112 views
Hello,

  I am trying to access the controls( textbox and dropdown) in template columns in the javascript. The way i am doing is,,,
 var lat = '<%=txtComments.ClientID %>';
                   var lon  = '<%= ddlReason.ClientID %>';

But i am getting a error that those controls are not declared...

I am calling that javascript function like thiss

 <telerik:GridTemplateColumn HeaderText="Reason" UniqueName="Reason" Visible = "false">
        <EditItemTemplate>
          <asp:DropDownList ID="ddlReason" runat="server" ToolTip="Reason"   OnSelectedIndexChanged="NoShowReason(); return    false;" >
 </asp:DropDownList>
</EditItemTemplate>
   </telerik:GridTemplateColumn>

How do i do this????

Appreciate the help
Thanks
Shinu
Top achievements
Rank 2
 answered on 28 Sep 2011
5 answers
109 views
Would it be possible to implement <EditFormTemplate> and <InsertFormTemplate> in RadGrid's <EditFormSettings>? Currently I have to have code behind (often done with <% %> tags but still server side code) to set the visibility, text, etc of controls on the <FormTemplate>, it would be so much better if the layout for both versions could be done with no server-side code. Other edit controls (eg RadListView) have separate templates for edit & insert and it works well.

Thanks

ROSCO

PS: I tried to add a feature request in PITS but couldn't seem to get it to work.
Lucania
Top achievements
Rank 1
 answered on 28 Sep 2011
5 answers
232 views
Hi,
I have a collection of about 500 classes I need to display in Telerik RadGrid.
The classes have a parent-child relationships data.
I have configured the grid like in examples for self-reference hierarchy, but when I run the application I get the following error:
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

The Parent property: GrpParentDeptId
Child property: GrpDeptId

I don't know why is this happening. I have only 500 rows!!!
I also tried setting the 
<system.web.extensions>  
   <scripting>  
       <webServices>  
          <jsonSerialization maxJsonLength="2147483644" />
       </webServices>  
   </scripting>  
</system.web.extensions>
but with no luck.
I am sending you the attachment with the views, code-behind, and the data xml I am pooling the data from.

Please help.
:-(
Nick Smith
Top achievements
Rank 1
 answered on 27 Sep 2011
6 answers
222 views
Hi,

I have a TreeView where all the nodes expand mode is set to ServerSideCallback. When new nodes are added their expand mode is also set to ServerSideCallback.

In my situation I need to expand the selected node based on the result of a partial postback.

On the server side I have a handler for the NodeExpand event.

protected void rtvMain_NodeExpand(object sender, RadTreeNodeEventArgs e)
{
    // Logic/Breakpoint here

}



And I have a javascript function that looks like this:

 function ExpandSelectedNode() {
                 var tree = $find("<%= rtvMain.ClientID %>");

                 if (tree.get_selectedNode() != null) {

                     var selectedNode = tree.get_selectedNode();
                     selectedNode.expand();
                 }
             }


After the ajax/partial postback I call the javascript function by registering a startup script. I use ScriptManager.RegisterStartupScript and call my javascript function "ExpandSelectedNode()"

In the treeview I see the default loading animation appear on the selected node, which would indicated it is performing an asynchronous operation. The problem is that the server side handler "rtvMain_NodeExpand()" never gets called.


However, when I click the [+] next to the treeview item the postback is fired and it calls "rtvMain_NodeExpand()" as it should. This tells me that my treeview and its nodes are configured properly. So I have to assume there is a bug in the RadTreeNode.expand() client side method that is preventing it from firing the server side callback.



Paul
Top achievements
Rank 1
 answered on 27 Sep 2011
5 answers
171 views
Hi,

In my grid i have <telerik:GridNumericColumn..../> columns.When grid goes into edit mode i add onFocus evenet handlers

GVDataGridNumericColumn gc = this.Columns[ColumnCounterIndex] as GVDataGridNumericColumn;
RadNumericTextBox radNumericTextBox = control as RadNumericTextBox;
//add event handler
radNumericTextBox.TextChanged += new EventHandler(RadGridRadNumericTextBox_TextChanged);
//add js event handler
radNumericTextBox.Attributes.Add("OnFocusIn", "StoreMe( radNumericTextBox.ClientID)");

In StoreMe stores ClientID in hidden field and in PageLoad

function pageLoad(sender, args)
{
$find(ClientID).focus();
}

this suppose to set focus in RadNumericTextBox, but somehow it doesn't.
alert($find(ClientID)); returns [object Object].

Please let me know where is the bug/mistake in code.

thanks
virendra
Mike
Top achievements
Rank 1
 answered on 27 Sep 2011
1 answer
55 views
Hi, 
 I encounter a problem that i use template edit form of grid, but in the edit form, the textbox value never be updated, always keep the old value. Can you help me find why this happen?  Please see the bold fonts.

Front code: 
<telerik:RadGrid ID="RadGridQuestionTable" runat="server" AllowFilteringByColumn="false"
                OnItemCommand="RadGridQuestionTable_ItemCommand" CssClass="contenttable" Width="100%"
                AllowPaging="True" AllowSorting="True" PageSize="10" ShowFooter="true" AutoGenerateColumns="False"
                Skin="Office2007" GridLines="None" ShowGroupPanel="False" EnableHeaderContextMenu="False"
                OnNeedDataSource="RadGridQuestionTable_NeedDataSource" >
                <ClientSettings AllowColumnHide="False" AllowColumnsReorder="True" AllowDragToGroup="False">
                </ClientSettings>
                <MasterTableView EnableViewState="false" DataKeyNames="ID" EditMode="PopUp">
                    <Columns>
                        <telerik:GridBoundColumn DataField="SectionID" HeaderText="" UniqueName="SectionID"
                            ItemStyle-Width="20px" Display="false">
                            <ItemStyle Width="20px"></ItemStyle>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Title" HeaderText="Question" UniqueName="Question"
                            ItemStyle-Width="200px">
                            <ItemStyle Width="200px"></ItemStyle>
                        </telerik:GridBoundColumn>
                        <telerik:GridButtonColumn Text="<img src='../Resource/images/edit.gif' border=0>"
                            CommandName="Edit" ButtonType="LinkButton" UniqueName="myEditColumn">
                            <ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
                        </telerik:GridButtonColumn>
                        <telerik:GridButtonColumn Text="<img src='../Resource/images/delete.gif' border=0>"
                            ConfirmText="Are you sure to delete this Question?" UniqueName="columnDelete"
                            CommandName="Delete" ButtonType="LinkButton" HeaderText="" ItemStyle-HorizontalAlign="center">
                            <ItemStyle HorizontalAlign="Center" Width="50px"></ItemStyle>
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings InsertCaption="Add new item" CaptionFormatString="Edit Question: {0}"  
                        CaptionDataField="Title" EditFormType="Template">
                        <FormTemplate>
                            <table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0">
                                <tr>
                                    <td>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Name:
                                    </td>
                                    <td>
                                        <telerik:RadTextBox ID="EditTitleTxt" runat="server" 
                                            Text='<%# Bind( "Title") %>' 
                                            Skin="Office2007">
                                        </telerik:RadTextBox>

                                    </td>
                                </tr>
                            </table>
                            <table style="width: 100%">
                                <tr>
                                    <td align="right">
                                        <asp:Button ID="Button1" Text="Update"
                                            runat="server"  CommandName="Update">
                                        </asp:Button>&nbsp;
                                        <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                        </asp:Button>
                                    </td>
                                </tr>
                            </table>
                        </FormTemplate>
                    </EditFormSettings>
                </MasterTableView>
                <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007">
                </HeaderContextMenu>
            </telerik:RadGrid>


Back-end Code: 

protected void RadGridQuestionTable_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int id = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"].ToString());
                try
                {
                    PPHGAuditQuestion questionObj = questionRespository.FindSingle((PPHGAuditQuestion s) => s.ID == id);
                    questionRespository.Delete(questionObj);
                    questionRespository.SaveChanges();
                    RadGridQuestionTable.DataSource = BindGrid(TemplateRadTreeView.SelectedNode == null ? 0 : int.Parse(TemplateRadTreeView.SelectedNode.Value));
                    RadGridQuestionTable.DataBind();
                }
                catch
                {
                    questionRespository.ClearChanges();
                }
            }
            else if (e.CommandName == "Update")
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                string title = (editedItem.FindControl("EditTitleTxt") as RadTextBox).Text;   // I also debug to here, the value always keep the old value.
                int id = int.Parse(e.CommandArgument.ToString());
                try
                {
                    PPHGAuditQuestion questionObj = questionRespository.FindSingle((PPHGAuditQuestion s) => s.ID == id);
                    questionObj.Title = title;
                    questionObj.ModifiedBy = "";
                    questionObj.DateModified = DateTime.Now;
                    questionRespository.UpdateOrCreate(questionObj);
                    questionRespository.SaveChanges();
                    RadGridQuestionTable.DataSource = BindGrid(TemplateRadTreeView.SelectedNode == null ? 0 : int.Parse(TemplateRadTreeView.SelectedNode.Value));
                    RadGridQuestionTable.DataBind();
                }
                catch
                {
                    questionRespository.ClearChanges();
                }
            }
        }
Jayesh Goyani
Top achievements
Rank 2
 answered on 27 Sep 2011
3 answers
66 views
i have a radGrid with ColumnFilters that allows paging as well. we've been doing exports to excel from an external button that's simply been running the same thing as the need datasource. however, the only thing i cannot figure out how to do is "capture" any column filtering. it seems like i have to use an external radFilter apart from the grid to do this. is there a way to get what someone has filtered to on the column? most of our grids use the external radFilter & this export works just fine, i can tap into those filters. just can't figure out if it's possible to do the same with the column filters. thanks for any help on this.
rik
rik butcher
Top achievements
Rank 1
 answered on 27 Sep 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?