Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
66 views
Hi,
I have a grid and its editformtemplate there is another grid. this inner grid maked inplace edits. I make manual update commands on inner grid to decide if I should update database or not. if I fond a problem and decide not to update database I set e.Canceled = True and want to show a warning label which is named lblneedTofindThisLabel below. Warning label is outside of inner gird, inside of formtemplate of outer grid. how can I find this control from inner grid's update command event ?

in other words:
    RadGridCompanies
        editformtemplate
            label
            InnerGrid (inplace edit)
                    Updateevent
                            -- must find label here.


<telerik:RadGrid ID="RadGridCompanies" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourceCompanies"
             GridLines="None" AllowAutomaticDeletes="false" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
             AllowPaging="True" AllowSorting="True" CellSpacing="0" Width="900px" Skin="Web20" PageSize="20">
             <GroupingSettings CaseSensitive="false" />
 
             <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true" EnableRowHoverStyle="True">
                 <Selecting AllowRowSelect="true" />
                 <Selecting AllowRowSelect="True"></Selecting>
             </ClientSettings>
 
 
             <MasterTableView DataKeyNames="ID, guidid" DataSourceID="SqlDataSourceCompanies" CommandItemDisplay="Top"
                 EditMode="PopUp">
                 <CommandItemSettings ExportToPdfText="Export to PDF"
                     ShowRefreshButton="False"></CommandItemSettings>
                 <RowIndicatorColumn>
                     <HeaderStyle Width="20px"></HeaderStyle>
                 </RowIndicatorColumn>
                 <ExpandCollapseColumn>
                     <HeaderStyle Width="20px"></HeaderStyle>
                 </ExpandCollapseColumn>
 
                 <Columns>
                     <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID" Visible="false">
                         <ColumnValidationSettings>
                             <ModelErrorMessage Text=""></ModelErrorMessage>
                         </ColumnValidationSettings>
                     </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="guidid" HeaderText="guidid" ReadOnly="True" SortExpression="guidid" UniqueName="guidid" Visible="false">
                         <ColumnValidationSettings>
                             <ModelErrorMessage Text=""></ModelErrorMessage>
                         </ColumnValidationSettings>
                     </telerik:GridBoundColumn>
                     
                    .... other columns..
 
                  <EditFormSettings EditFormType="Template" PopUpSettings-Width="950px" PopUpSettings-Height="650px">
                               <EditColumn UniqueName="EditCommandColumn1">
                               </EditColumn>
                               <FormTemplate>
                                  
                                  
                                  <telerik:RadGrid ID="RadGridMids" runat="server" AllowAutomaticUpdates="false" OnUpdateCommand="RadGridMids_UpdateCommand"
                                             DataSourceID="SqlDataSourceMids" GridLines="None" Skin="Web20" AutoGenerateColumns="False" CellSpacing="0" Width="800px">
                                             <ClientSettings EnableRowHoverStyle="True">
                                             </ClientSettings>
                                             <MasterTableView DataKeyNames="ID" DataSourceID="SqlDataSourceMids" EditMode="InPlace" CommandItemDisplay="Top">
                                                 <Columns>
                                                     <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" ReadOnly="True" UniqueName="ID" Visible="false"></telerik:GridBoundColumn>
 
                                                     <telerik:GridTemplateColumn DataField="Bank" FilterControlAltText="Filter BankName column" HeaderText="Bank" SortExpression="Bank" UniqueName="Bank">
                                                         <EditItemTemplate>
                                                             <asp:TextBox ID="BankTextBox" runat="server" Text='<%# Bind("Bank") %>'></asp:TextBox>
                                                         </EditItemTemplate>
                                                         <ItemTemplate>
                                                             <asp:Label ID="BankLabel" runat="server" Text='<%# Eval("Bank") %>'></asp:Label>
                                                         </ItemTemplate>
                                                          
                                                         ... other columns...
                                                          
                                                     </telerik:GridTemplateColumn>
                                                            <telerik:GridEditCommandColumn>
                                                     </telerik:GridEditCommandColumn>
                                                 </Columns>
                                                 <EditFormSettings>
                                                     <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                                                 </EditFormSettings>
                                             </MasterTableView>
                                             <FilterMenu EnableTheming="True">
                                                 <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                             </FilterMenu>
                                 </telerik:RadGrid>
                                          
                                <asp:Label ID="lblneedTofindThisLabel" runat="server" Text="label to find" Visible="false" ></asp:Label>
                                                             
                     </FormTemplate>
                     <PopUpSettings Modal="True" Width="1000px" />
                 </EditFormSettings>
 
             </MasterTableView>
             <FilterMenu EnableImageSprites="False">
             </FilterMenu>
         </telerik:RadGrid>

and the code is :

Protected Sub RadGridMids_UpdateCommand(sender As Object, e As GridCommandEventArgs)
 
      Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
      Dim ID_ As String = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("ID").ToString()
       
     ' .... some logic....
       
     ' -- WHAT X should be. ?
       
      Dim lblneedTofindThisLabel As Label = (TryCast(x.FindControl("lblneedTofindThisLabel"), Label))
       
      lblneedTofindThisLabel.visible=true
         end sub
Eyup
Telerik team
 answered on 02 Oct 2014
1 answer
95 views
I am unable to get sorting  to work for this grid as well as to control the size of the filter text boxes for this grid.
I think the problem is associated with the way I select the datasource but I do not know how to fix it and I need to allow selecting the Sql table to the user.

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList1.DataSource = SqlDataSource2;
            DropDownList1.DataBind();
        }
        SetDataSource();
    }
 
    protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedIndex > 0)
        {
            SetDataSource();
            RadGrid1.Rebind();
        }
    }
 
    private void SetDataSource()
    {
        if (DropDownList1.SelectedIndex > 0)
        {
            string tableInUse = DropDownList1.SelectedItem.Text;
            RadGrid1.DataSource = SqlDataSource1;
            SqlDataSource1.DeleteCommand = "DELETE FROM [" + tableInUse + "] WHERE [Id] = @Id";
            SqlDataSource1.InsertCommand = "INSERT INTO [" + tableInUse + "] ([Code], [Description], [Bkgroup], [Stgroup], [Quantity], [BomNote], [UnitEng], [AlternCost]) VALUES (@Code, @Description, @Bkgroup, @Stgroup, @Quantity, @BomNote, @UnitEng, @AlternCost)";
           SqlDataSource1.SelectCommand = "SELECT prod.Id, prod.Code, prod.Description, prod.Bkgroup, prod.Stgroup, prod.Quantity," +
                                           "prod.BomNote, prod.UnitEng, prod.AlternCost, comp.Unit, comp.Cost, comp.NoteComp " +
                                           "FROM  " + tableInUse + " prod " +
                                           "left JOIN  Components comp ON  comp.Code = prod.Code";
            SqlDataSource1.UpdateCommand = "UPDATE [" + tableInUse + "] SET [Code] = @Code, [Description] = @Description, [Bkgroup] = @Bkgroup, [Stgroup] = @Stgroup, [Quantity] = @Quantity, [BomNote] = @BomNote, [UnitEng] = @UnitEng, [AlternCost] = @AlternCost WHERE [Id] = @Id";
        }
    }
 
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        RadGrid1.DataSource = SqlDataSource1;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.TableLayout = GridTableLayout.Auto;
        RadGrid1.AllowFilteringByColumn = true;
        RadGrid1.MasterTableView.AllowFilteringByColumn = true;
        RadGrid1.Rebind();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.TableLayout = GridTableLayout.Auto;
        RadGrid1.AllowFilteringByColumn = false;
        RadGrid1.MasterTableView.AllowFilteringByColumn = false;
        RadGrid1.Rebind();
    }
      protected void RadGrid1_ItemCreated1(object sender, GridItemEventArgs e)
       {
       if (e.Item is GridFilteringItem)
        {
            GridFilteringItem filteringItem = e.Item as GridFilteringItem;
            //set dimensions for the filter textbox  
            TextBox box = filteringItem["Code"].Controls[0] as TextBox;
            box.Width = Unit.Pixel(30);
        }
    }

If I try to use the Item_created event to control the size of the filter text boxes, I get a null reference exception.

<div>
           <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" AppendDataBoundItems="true" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged1" DataTextField="Name" DataValueField="Name">
               <asp:ListItem Text="-Select a BOM" />
           </asp:DropDownList>
           <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:BOMConnectionString %>" SelectCommand="SELECT [Name] FROM [IndexTabb]"></asp:SqlDataSource>
           <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Filter On" />
           <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Filter Off" />
           <br />
           <br />
           <br />
           <telerik:RadGrid ID="RadGrid1" runat="server" Culture="it-IT" AllowPaging="True" AllowSorting="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCreated="RadGrid1_ItemCreated1">
               <ExportSettings ExportOnlyData="True">
                   <Pdf PageWidth="">
                   </Pdf>
               </ExportSettings>
               <ClientSettings>
                   <Scrolling AllowScroll="True" UseStaticHeaders="True" />
               </ClientSettings>
               <MasterTableView CommandItemDisplay="Top" DataKeyNames="Code" InsertItemPageIndexAction="ShowItemOnCurrentPage" AllowNaturalSort="False">
                   <CommandItemSettings ShowExportToExcelButton="True" />
                   <Columns>
                       <telerik:GridEditCommandColumn ButtonType="ImageButton">
                           <HeaderStyle Width="30px" />
                       </telerik:GridEditCommandColumn>
                       <telerik:GridButtonColumn ButtonType="ImageButton" Text="Delete" CommandName="Delete" FilterControlAltText="Filter column1 column" ConfirmDialogType="RadWindow" ConfirmText="Do you really want to delete this project and all its content?" UniqueName="Cancel">
                           <HeaderStyle Width="30px" />
                       </telerik:GridButtonColumn>
                   </Columns>
                   <EditFormSettings>
                       <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
                   </EditFormSettings>
                   <PagerStyle AlwaysVisible="True" />
               </MasterTableView>
               <PagerStyle AlwaysVisible="True" />
           </telerik:RadGrid>
           <br />
           <br />
       </div>
       <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:BOMConnectionString %>">
       </asp:SqlDataSource>
And sorting is not working. When I click on the header of the column I can see the small arrow changing up or down but nothing happens.
How can I get control of the filter text boxes size and make the sorting working in this context?
Any help will be appreciated.
Eyup
Telerik team
 answered on 02 Oct 2014
1 answer
98 views
Needing to do a gantt chart based on fy and quarters.
Any suggestions.
Bozhidar
Telerik team
 answered on 02 Oct 2014
1 answer
100 views
hi

This my code:
  
<telerik:RadTextBox ID="RadTextBox1" Runat="server" Resize="None" Rows="1" TextMode="MultiLine" Width="160px"> </telerik:RadTextBox>

As you can see, the Rows attribute is set to 1, which means it should display as 1 row in the browser. But it is not getting it right in FF 32.0. It works fine in IE 11 and chrome.

How do i solves this? Thanks a lot.
Eyup
Telerik team
 answered on 02 Oct 2014
2 answers
327 views
Hi, is it possible to have column headers with vertical text in RadGrid?  Right now we do this by putting the text in images, but that solution is not very flexible if the text needs to change.
Angel Petrov
Telerik team
 answered on 02 Oct 2014
3 answers
70 views
Hi,

we are trying to use RadEditor within DotNetNuke CMS and here is the problem. 
We are saving small parts of HTML in templates to help content manager insert UI elements quicker.
But after pasting template content manager can't step out to the end of HTML makeup.
Example.
We have HTML template for button:
<a href="/some-page" class="green_btn">
<span class="bg">
<span class="icon"></span>
<span class="txt">Some text</span>
</span>
</a>
After insertion the cursor is placed at the end of "Some text" (see pic.1 attached) inside button. We need to skip to the end of HTML and continue to enter regular text (see pic.2 with desired cursor position). 
How we can do this? I mean - may be there is hot key for that? Or do we have to wrap templates in paragraphs or put but <br/>s in templates?
Click on the white space after button doesn't help. "End" and "Ctrl+End" keys can't help too.
Ianko
Telerik team
 answered on 02 Oct 2014
3 answers
590 views

Is there a way that I can conditionally hide a column filter in a RadGrid from the code behind based on the data column name when the RadGrid is set to AutoGenerateColumns="true"?

Example:
I assign a datatable as the RadGrid's datasource. I want to intercept some RadGrid event to see if column "TEST" was added, and if so, then hide the filter for that column in the RadGrid.


Thank you,

-Scott

Wired_Nerve
Top achievements
Rank 2
 answered on 01 Oct 2014
6 answers
420 views
Hi,
        I have a RadEditor in my page. I want to limit the maximum number of characters entered. I need not to dispaly the message if the maximum character is reached. But i need to  block the characters entered by the user if it reached the maximum length. Please give the solution for this problem.

Thanks,
Velkumar
Greg
Top achievements
Rank 1
 answered on 01 Oct 2014
2 answers
89 views
I'd post this as a support ticket, but our support just ran out last week (of course)...

This seems to be a new issue with 2014.2.724.45, as the exact same code is working on our production site but is giving this error in Firefox on our Beta site

IndexSizeError: Index or size is negative or greater than the allowed amount

The error shows up in the if(c.originalMaxLength) line below

updateValue:function(d){var c=$get(this._id);
var e;
var f=c.value;
if(c.originalMaxLength){c.maxLength=c.originalMaxLength;
}if(typeof(d)=="undefined"){e=c.value;

This is showing up on our Login page that uses telerik:RadInputManager to make the user name and password fields required.

<telerik:RadInputManager runat="server" ID="rim">
    <telerik:TextBoxSetting BehaviorID="textRequired">
        <Validation IsRequired="true" />
        <TargetControls>
            <telerik:TargetInput ControlID="UserName" />
            <telerik:TargetInput ControlID="Password" />
        </TargetControls>
    </telerik:TextBoxSetting>
</telerik:RadInputManager>

If I comment out the RadInputManager, the page works fine, although without validation. If I leave the code in, we get the error message in the Firebug console in Firefox 32.0.3 and the password box won't accept any typing at all. It works fine in IE and Chrome.

Live beta site example at https://beta.connectionsonline.net/

I noticed that Mozilla has a similar issue listed as a bug with Firefox 30 and 31, but I'm not sure if it is related: https://bugzilla.mozilla.org/show_bug.cgi?id=987227
Sypher
Top achievements
Rank 1
 answered on 01 Oct 2014
1 answer
340 views
Hai all,

i want to change all my reports into telerik reports using typed dataset please help me how to do for that what i did is

1.first i create a Dataset1.xsd file in that i added a TableAdapter DataTable1 there i am getting somefileds and GetData()
2.then i created a Report1.cs(Telerik Report Q1 2014) there i added a objectdatasource in that i selected Select Available data source types tab ther i added my DataTable1 and in Choose Datasource Member i selecte GetData() and i click on finsih button
but when i select on Telerik=>Reporting=>DataExplorer its showing NoDatasource

how to use these datatable in my reports how to do please give me one sample example how to do its urgent


thanks in advance
Stef
Telerik team
 answered on 01 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?