Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
81 views
Hi,
Is it possible to minimize distance between node's default image and node's text?   I could not find reletaed style property in TreeView.css file. I attached the screen shot of tree to point the distance I want to narrow.
Thank you,
Kate
Telerik team
 answered on 06 Apr 2011
2 answers
343 views
Hi,

I am using RadWindow as ContentTemplate and in the Content Template I am using a Custom UserControl to do some functionality. In my Default Page, I have a RadWindow which also has a UserControl as ContentTemplate. When this window Opens the user can click a button to open another RadWindow with UserControl as Content Template. Now in this User Control I do some things and then I want to close the window. I can register a startup script from server side to call a CloseWindow javascript function. But the problem is that I can't get the reference of the RadWindow using the GetRadWindow() function, which is used on the content pages to get the reference of the radWindow. But this function does not give me the reference to the Rad window. 
Here is a sample of how i am using most of my RadWindows:
<telerik:RadWindow ID="rw_EditObjectRecordScreen" runat="server" Modal="true" Behaviors="Close, Move, Resize  "
    Width="900px" Height="500px" Visible="true"
    OnClientClose="CloseEditObjectRecordWindowODR"
    DestroyOnClose="true" >
    <ContentTemplate>
        <uc1:EditObjectRecord ID="EditObjectRecord1" runat="server" />
    </ContentTemplate>
</telerik:RadWindow>

I am not using any ScriptManager or AjaxManager, or RadWindowManager on any of my pages. I only use AjaxPanel to wrap all my user Controls. then I use these User Controls in the RadWindow's ContentTemplate. and i open the window from server side by setting the Visible on Page Load property to TRUE.
Is there a way to Close the RadWindow, which is used as a Content Template and the Content is a User Control, from with in the UserControl Code? I have tried GetRadWindow() method but it does not work. then I also tried the following:
function GetContentRadWindow() {
                //using ContentTemplate instead of Navigate URL
                //for RadWindow so we need to get RadWindow by name
                var oWnd = GetRadWindowManager().getWindowByName("RadContentWindow");
                return oWnd;
            }
 but as I am not using any WindowManager so this also did not work. and This code is run on the Page where the RadWindow is defined and not inside the Content.

Any help will be appriciated.

/MO
Mojeeb
Top achievements
Rank 1
 answered on 06 Apr 2011
1 answer
81 views
Hi.
I have a grid with a comboBox that use the event SelectedIndexChanged. AutoPostBack is set to true. The problem is that the event handler does not fired every time the comboBox index changed (in insert-mode), nearly never. When the index changed and it has not fired and i fill in values in some RadTextBox, then it fired when i save the new record. (I have also tried to use the OnTextChanged event and same happens here.)  The comboBox contain a list of companies and i use LinqDataSoure to get the companies.

Here is the code i am using and the  comboBox that not work correctly is with the id= Company :

protected void CompanyComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
      {         
          var combo = (RadComboBox) sender;
          if (combo == null)
              return;
           
          var item = combo.NamingContainer is GridEditFormInsertItem ? (GridEditFormInsertItem)combo.NamingContainer : (GridEditFormItem)combo.NamingContainer;           
          var userNumberBox = (RadNumericTextBox)item.FindControl("UserNumber");
 
          string userNumber = userNumberBox.Text;
          string companyId = combo.SelectedValue;
 
          if (string.IsNullOrEmpty(userNumber) || string.IsNullOrEmpty(companyId))
              return;
 
          var firstNameBox = (RadTextBox)item.FindControl("FirstName");
          var lastNameBox = (RadTextBox)item.FindControl("lastName");
 
          User user = GetUser(userNumber, companyId);
          if (user != null)
          {
              firstNameBox.Text = user.FirstName;
              lastNameBox.Text = user.LastName;
          }
          else
          {
              firstNameBox.Text = string.Empty;
              lastNameBox.Text = string.Empty;
          }
      }

<EditFormSettings EditFormType="Template">
           <EditColumn UniqueName="EditCommandColumn1" ></EditColumn>
          <FormTemplate>                
                    <div id="column1" style="float:left;padding:10px;">
                        <div style="padding-bottom:7px;">
                            <table>                     
                                <tr><td><asp:Label ID="NumberLabel" runat="server" Text="Brukernr.:"></asp:Label></td><td><telerik:RadNumericTextBox runat="server" OnTextChanged="UserNumberTextBox_TextChanged" AutoPostBack="true" ID="UserNumber" Width="107" DataType="System.Int32"><NumberFormat DecimalDigits="0" GroupSeparator=""/></telerik:RadNumericTextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" Text="*" ForeColor="Red" ControlToValidate="UserNumber" runat="server"/>
                                <asp:Label ID="Label21" runat="server" Text="Aktiv"></asp:Label>
                                <telerik:RadComboBox runat="server" ID="RadComboBoxActive" Width="45px" DataValueField="IsActive" AutoPostBack="true">
                                    <Items>                             
                                        <telerik:RadComboBoxItem Value="1" Text="Ja"/>
                                        <telerik:RadComboBoxItem Value="0" Text="Nei"/>
                                    </Items>
                                </telerik:RadComboBox></td></tr>
                               <tr><td><asp:Label ID="CompanyLabel" runat="server" Text="Selskap/Avd.:"></asp:Label></td>
                                               <
td colspan="2"><telerik:RadComboBox  ID="Company" runat="server" OnSelectedIndexChanged="CompanyComboBox_SelectedIndexChanged" CausesValidation="true" AutoPostBack="true"   DataSourceID="CompanyDataSource"  DataTextField="Name" DataValueField="CompanyId"  EmptyMessage="Velg et element" AllowCustomText="true"></telerik:RadComboBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" Text="*" ForeColor="Red" ControlToValidate="Company" runat="server"/></td></tr>                                                                                               
                            </table>
                        </div>
                     </div>
                     <div id="column1b" style="float:left;padding:10px;">
                        <div style="padding-bottom:7px;">
                            <table>                    
                                <tr><td><asp:Label ID="FirstNameLabel"  runat="server" Text="Fornavn:"></asp:Label></td><td><telerik:RadTextBox ID="FirstName"  runat="server"  Width="150" MaxLength="20"></telerik:RadTextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" Text="*" ForeColor="Red" ControlToValidate="FirstName" runat="server"/></td></tr>
                                <tr><td><asp:Label ID="LastNameLabel"   runat="server" Text="Etternavn:"></asp:Label></td><td><telerik:RadTextBox ID="LastName"   runat="server" Width="150" MaxLength="20"></telerik:RadTextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator8" Text="*" ForeColor="Red" ControlToValidate="LastName" runat="server"/></td></tr>                           
                           </table>                   
                        </div>                                                                  
                    </div>                                                                                                         
Dimitar Terziev
Telerik team
 answered on 06 Apr 2011
2 answers
233 views
I have a grid with three nested levels

the tables are as follows:

Forms
Form Sections
Form Items

You can have many sections within a form and many items within a form section. I am using a radwindow to edit and add items from this grid. In the command Item Template I have a Link buttons that allow me to enter new records, but i am having trouble getting the datakeyvalue when it comes to the add new buttons.

Heres my grid code:

<telerik:RadGrid ID="RadGrid1" DataSourceID="DSForms" runat="server" ShowStatusBar="true" AutoGenerateColumns="False" PageSize="30" AllowSorting="True" AllowMultiRowSelection="False"
            AllowPaging="True" GridLines="None" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnDeleteCommand="RadGrid1_DeleteCommand">           
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <MasterTableView DataSourceID="DSForms" DataKeyNames="Form_ID" AllowMultiColumnSorting="True" Width="100%" CommandItemDisplay="Top"  CommandItemSettings-RefreshImageUrl="~/images/refresh.gif" CommandItemSettings-RefreshText="Refresh" CommandItemSettings-AddNewRecordText="Add Form" Name="Forms">
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="FormSection_ID, Form_ID" DataSourceID="DSFormSections" Width="100%" runat="server" CommandItemDisplay="Top"  Name="FormItems">
                        <CommandItemTemplate>
                            <asp:HyperLink ID="AddSectionLink" runat="server" Text="Add Section"></asp:HyperLink>
                        </CommandItemTemplate>
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="Form_ID" MasterKeyField="Form_ID" />
                        </ParentTableRelation>
                        <DetailTables>
                            <telerik:GridTableView DataKeyNames="FormSection_ID,FormItem_ID" DataSourceID="DSFormItems" CommandItemDisplay="Top" Width="100%" runat="server">
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="FormSection_ID" MasterKeyField="FormSection_ID" />
                                </ParentTableRelation>
                                <AlternatingItemStyle BackColor="LightCyan" />
                                <CommandItemTemplate>
                                    <asp:HyperLink ID="AddFormItemLink" runat="server" Text="Add Item"></asp:HyperLink>
                                </CommandItemTemplate>
                                <Columns>
                                    <telerik:GridBoundColumn SortExpression="FormItem_Question" HeaderText="Question" HeaderButtonType="TextButton"
                                        DataField="FormItem_Question" UniqueName="FormItem_Question">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="FormItem_QuestionValues" HeaderText="FormItem_QuestionValues" HeaderButtonType="TextButton"
                                        DataField="FormItem_QuestionValues" Visible="false" UniqueName="FormItem_QuestionValues">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="FormItem_Type" HeaderText="FormItem_Type" HeaderButtonType="TextButton"
                                        DataField="FormItem_Type" Visible="false" UniqueName="FormItem_Type">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="FormItem_Grid" HeaderText="FormItem_Grid" HeaderButtonType="TextButton"
                                        DataField="FormItem_Grid" Visible="false" UniqueName="FormItem_Grid">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridButtonColumn ConfirmText="Delete this Form Item?" ButtonType="ImageButton"
                                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                        <HeaderStyle Width="20px" />
                                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                                    </telerik:GridButtonColumn>
                                    <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" ItemStyle-Width="20px">
                                        <ItemTemplate>
                                            <asp:HyperLink ID="EditItemLink" runat="server"><img src="/images/edit.gif" alt="Edit" border="0" /></asp:HyperLink>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                </Columns>
                                <SortExpressions>
                                    <telerik:GridSortExpression FieldName="FormItem_Sort" SortOrder="Descending"></telerik:GridSortExpression>
                                </SortExpressions>
                            </telerik:GridTableView>
                        </DetailTables>
                        <AlternatingItemStyle BackColor="AliceBlue" />
                        <Columns>
                            <telerik:GridBoundColumn SortExpression="FormSection_ID" HeaderText="ID" HeaderButtonType="TextButton"
                                DataField="FormSection_ID" UniqueName="FormSection_ID" ReadOnly="true" Visible="false">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="FormSection_Title" ReadOnly="true" HeaderText="Section" Visible="true"  HeaderButtonType="TextButton"
                                DataField="FormSection_Title" UniqueName="FormSection_Title">
                            </telerik:GridBoundColumn>
                            <telerik:GridButtonColumn ConfirmText="Delete this Form Section Item?" ButtonType="ImageButton"
                                CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                <HeaderStyle Width="20px" />
                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                            </telerik:GridButtonColumn>
                            <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" ItemStyle-Width="20px">
                                <ItemTemplate>                                   
                                    <asp:HyperLink ID="EditSectionLink" runat="server"><img src="/images/edit.gif" alt="Edit" border="0" /></asp:HyperLink>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
 
                        </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="FormSection_Sort"></telerik:GridSortExpression>
                        </SortExpressions>
                        <EditFormSettings EditFormType="Template">
                        <FormTemplate>
                        <table id="tblitems" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
                            style="border-collapse: collapse; background: white;">
                            <tr>
                                <td>
                                    <table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">
                                        <tr><td colspan="2"></td></tr>
 
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                        runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                    </asp:Button> 
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                </td>
                            </tr>
                        </table>                       
                        </FormTemplate>
                        </EditFormSettings>
                    </telerik:GridTableView>                   
                </DetailTables>
                <Columns>               
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"><HeaderStyle Width="20px" /></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn SortExpression="Form_ID" HeaderText="Form_ID" ItemStyle-Width="30px" HeaderButtonType="TextButton" DataField="Form_ID" UniqueName="Form_ID" Visible="false" ReadOnly="true" />
                    <telerik:GridBoundColumn SortExpression="Form_Title" HeaderText="Form" ItemStyle-Width="300px" HeaderButtonType="TextButton" DataField="Form_Title" UniqueName="Form_Title" />
                    <telerik:GridButtonColumn ConfirmText="Delete this Form?" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"><HeaderStyle Width="20px" /><ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /></telerik:GridButtonColumn>
                </Columns>
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="Form_Title" SortOrder="Descending"></telerik:GridSortExpression>
                </SortExpressions>
                <EditFormSettings EditFormType="Template">               
                    <FormTemplate>
                        <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none" style="border-collapse: collapse; background: white;">
                            <tr>
                                <td>
                                    <table id="Table3" cellspacing="1" cellpadding="1" border="0">
                                        <tr><td colspan="2"></td></tr>
                                        <tr>
                                            <td>Form Name: </td>
                                            <td><asp:TextBox ID="TextBox7" Width="350px" runat="server" Text='<%# Bind( "Form_Title" ) %>'></asp:TextBox></td>
                                        </tr>
                                        <tr><td colspan="2"></td></tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                        runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                    </asp:Button> 
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                </EditFormSettings>
 
            </MasterTableView>
        </telerik:RadGrid>


And here is some of my code behind where I am trying to assign the rad window code to the buttons, the edit code works fine just not the add new buttons:

Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
 
    If e.Item.OwnerTableView.DataSourceID = "DSFormSections" Then
        If TypeOf e.Item Is GridDataItem Then
            Dim EditSectionLink As HyperLink = DirectCast(e.Item.FindControl("EditSectionLink"), HyperLink)
            EditSectionLink.Attributes("href") = "#"
            EditSectionLink.Attributes("onclick") = [String].Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("FormSection_ID"), e.Item.ItemIndex)
        End If
    End If
 
    If e.Item.OwnerTableView.DataSourceID = "DSFormItems" Then
        If TypeOf e.Item Is GridDataItem Then
            Dim EditItemLink As HyperLink = DirectCast(e.Item.FindControl("EditItemLink"), HyperLink)
            EditItemLink.Attributes("href") = "#"
            EditItemLink.Attributes("onclick") = [String].Format("return ShowEditItemForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("FormItem_ID"), e.Item.ItemIndex)
        End If
    End If
 
 
    If e.Item.OwnerTableView.DataSourceID = "DSFormSections" Then
        If TypeOf e.Item Is GridCommandItem Then
            Dim AddSectionLink As HyperLink = DirectCast(e.Item.FindControl("AddSectionLink"), HyperLink)
            AddSectionLink.Attributes("href") = "#"
            AddSectionLink.Attributes("onclick") = "return ShowInsertForm();"
        End If
    End If
 
    If e.Item.OwnerTableView.DataSourceID = "DSFormItems" Then
        If TypeOf e.Item Is GridCommandItem Then
            Dim AddFormItemLink As HyperLink = DirectCast(e.Item.FindControl("AddFormItemLink"), HyperLink)
            AddFormItemLink.Attributes("href") = "#"
            AddFormItemLink.Attributes("onclick") = "return ShowInsertItemForm();"
        End If
    End If
 
End Sub


Any ideas what i am doing wrong in the RadGrid1_ItemCreated as the e.item.itemindex is -1 for the add new items.

Iana Tsolova
Telerik team
 answered on 06 Apr 2011
2 answers
54 views

I'm using version 2011.1.329.35 ,

the RadAsyncUpload is working fine in other browsers (IE,Firefox,etc..),

but it not working in Opera 11.10 

strange thing, I' have tested your demo site, that's fine. no any problem.

but in my project, is always show the error tip (red image mark, not green). 

am I missing something?

does any one can tell me what I need change?

thanks .

Anders
Top achievements
Rank 1
 answered on 06 Apr 2011
1 answer
104 views
Hi I'm using RadEditor and the modal popup ImageManager.  I'm finding that the image manager is loading too far to the right.  Is there a way to set this so that when the image manager pops up it will be in the top left?

Thanks!
Devin
Rumen
Telerik team
 answered on 06 Apr 2011
10 answers
608 views
I've recently migrated one of my web forms from VS2005 and Telerik Q3 2008 to VS2010 and Telerik Q2 2010.  The form contains a RadMultiPage with (12) RadPageView objects.  I get the following error when I try to browse this web form.  I can build the page without any errors and can view the multipage\pageviews successfully in design view, so I'm not sure what causes this error.

Any assistance would be greatly appreciated.

RadPageViewCollection must contain RadPageView objects




Veronica
Telerik team
 answered on 06 Apr 2011
3 answers
60 views
I am inheriting RADtoolbar in my own class and its not working. Any advice ? Other controls like radgrid are working fine.
Veronica
Telerik team
 answered on 06 Apr 2011
3 answers
90 views
Is it possible to just enable sorting on the grid and then allow the users to sort the data in the grid, without having to add any code, behind the scenes? 
Princy
Top achievements
Rank 2
 answered on 06 Apr 2011
3 answers
107 views
I have a calendar that has EnableMultiSelect=true. The user is now able to select one or multiple dates on the calendar. On the server side I need to know the date that user clicks if he is selecting one at a time. Currently the selected date property seems to be good only for single selection mode. The selecteddates property for the multiselectionmode has all the selected dates which does not help me. I need to know the date the user clicked on when the calendar is in multiselection mode. The focused date does not seem to hold the correct value either.

Thanks,
Vithiya
Shinu
Top achievements
Rank 2
 answered on 06 Apr 2011
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?