Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
321 views
I'm trying to figure out how to insert a record by using a UserControl. I have a Master Gridview with a child gridview and want to be able to insert a new record into the child grid. I have created a UserControl  "InsertOil.ascx" and added a reference to it in the RadGrid but when I click on the Add New Record button I only get the built in edit/insert form which works so I guess I have not configured the grid to call the UserControl properly. I will post the relevant code in hopes that someone can stewer me in the right directio before I go completely mad. Thanks for any help.          




<%@ Page Title="" Language="VB" MasterPageFile="~/Facilities.master" AutoEventWireup="false" CodeFile="OilAdditions.aspx.vb" Inherits="SiteReporting_OilAdditions" %>  
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>  
 
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">  
 
<telerik:RadGrid ID="RadGrid1"   
                 runat="server"   
                 DataSourceID="sdsGenerators"   
                 GridLines="None"   
                 ShowGroupPanel="True" Skin="Hay"   
                 AutoGenerateColumns="False" 
                 Width="500px">  
 
<MasterTableView DataSourceID="sdsGenerators"   
                 GroupLoadMode="Client"   
                 DataKeyNames="EquipmentID"   
                 HierarchyLoadMode="Client" 
                   
                   
                   
                 >  
 
 
    <DetailTables>  
        <telerik:GridTableView  runat="server"   
                                DataSourceID="sdsOilAdditions"   
                                AllowAutomaticInserts="True"   
                                GroupLoadMode="Client"   
                                HierarchyLoadMode="Client" AllowPaging="True"   
                                CommandItemDisplay="Top">  
            <ParentTableRelation>  
                <telerik:GridRelationFields  DetailKeyField="EquipmentID"   
                                             MasterKeyField="EquipmentID" />  
            </ParentTableRelation>  
              
            <Columns>  
                <telerik:GridBoundColumn DataField="DateAdded" DataFormatString="{0:dd MMM,  yy}" HeaderText="DateAdded" DataType="System.DateTime" UniqueName="DateAdded">  
                </telerik:GridBoundColumn>  
                <telerik:GridBoundColumn DataField="Quantity" HeaderText="Qty (Gals)" DataType="System.Double" UniqueName="Quantity">  
                </telerik:GridBoundColumn>  
                <telerik:GridBoundColumn DataField="Scheduled" HeaderText="Added During RWP" DataType="System.Boolean" UniqueName="Scheduled">  
                </telerik:GridBoundColumn>  
                  
 
 
                 
            </Columns>  
              
        </telerik:GridTableView>  
    </DetailTables>  
                
<ExpandCollapseColumn Visible="True"></ExpandCollapseColumn>  
                
            <Columns>  
                <telerik:GridBoundColumn DataField="EquipmentID_Old"   
                                         HeaderText="Generator"   
                                         SortExpression="EquipmentID_Old"   
                                         UniqueName="EquipmentID_Old">  
                </telerik:GridBoundColumn>  
            </Columns>  
            <EditFormSettings UserControlName="InsertOil.ascx" EditFormType="WebUserControl">  
                    <EditColumn UniqueName="EditCommandColumn1">  
                    </EditColumn>  
                </EditFormSettings>  
     </MasterTableView>  
         
    </telerik:RadGrid>  
       
    <asp:SqlDataSource ID="sdsGenerators" runat="server"   
        ConnectionString="<%$ ConnectionStrings:AAIOMSConnectionString %>"   
        SelectCommand="spSelectFAC_PowerPlantsBySiteID"   
        SelectCommandType="StoredProcedure">  
        <SelectParameters>  
            <asp:SessionParameter DefaultValue="7" Name="SiteID" SessionField="SiteID"   
                Type="Int32" />  
        </SelectParameters>  
    </asp:SqlDataSource>  
     
    <asp:SqlDataSource ID="sdsOilAdditions" runat="server"   
        ConnectionString="<%$ ConnectionStrings:AAIOMSConnectionString %>"   
        SelectCommand="spSelectFAC_OilAdditionsByEquipmentID"   
        SelectCommandType="StoredProcedure"   
        InsertCommand="spInsertFAC_OilAdditions" InsertCommandType="StoredProcedure">  
        <SelectParameters>  
            <asp:SessionParameter Name="EquipmentID"  SessionField="EquipmentID"   
                Type="Int32" />  
        </SelectParameters>  
        <InsertParameters>  
            <asp:Parameter Name="EquipmentID"  Type="Int32" />  
            <asp:Parameter Name="DateAdded" Type="DateTime" />  
            <asp:Parameter Name="Scheduled" Type="Boolean" />  
            <asp:Parameter Name="Quantity" Type="Double" />  
            <asp:Parameter Name="AddedBy" Type="String" />  
        </InsertParameters>  
    </asp:SqlDataSource>  
</asp:Content>  
 

Here is the User Control 
 
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="InsertOil.ascx.vb" Inherits="WorkOrders_InsertOil" %>  
 
        EquipmentID<asp:TextBox ID="txtEquipmentID" runat="server"></asp:TextBox><br />  
        Date Added<asp:TextBox ID="txtDateAdded" runat="server"></asp:TextBox><br />  
        Quantity<asp:TextBox ID="txtQuantity" runat="server"></asp:TextBox><br />  
        Added By<asp:TextBox ID="txtAddedBy" runat="server"></asp:TextBox><br />  
        Scheduled<asp:CheckBox ID="chkScheduled" runat="server" /> 


AkAlan
Top achievements
Rank 2
 answered on 23 Oct 2009
1 answer
110 views
Hi, I´m using multiples RadComboBoxes (Q3 2008) combined with RadTabStrip  and after making one selection, when I move to the next combo the first combo becames unresponsive (even the hover isn´t working). To be able to change the firt selection I have to click anywhere in the page first.

Does anyboby experienced this before?

Thanks,

Rod
Simon
Telerik team
 answered on 23 Oct 2009
3 answers
146 views
RadChart will not display after deploying compiled code to my staging server, but runs fine on my local development environment.

Dev environment is Win7 64bit, iis7 in integrated mode.

Staging is Windows 2003 server 64 bit.

Http handlers look like this:
in system.web:
<add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/> 

in system.webserver:
<add name="ChartImage_axd" verb="*" preCondition="integratedMode" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler"/> 

Any help on getting this working on the 2003 server would be much appreciated!!
Giuseppe
Telerik team
 answered on 23 Oct 2009
4 answers
225 views
Is there a way to keep the cursor from changing to a text select when hovering over the combo box? I tried using EnableTextSelection="false", but this did not seem to have any effect. I don't want the user to type in the combo box. I also want the pointer cursor regardless of where you are hovering over the combobox.

Thanks,
Levi
Vishwa
Top achievements
Rank 2
 answered on 23 Oct 2009
2 answers
94 views

hi,

i have added the following style to aspx page. But still image is getting disappered on mouse hover.
I am using telerik verion 2009.2.826.20.

please help me....

 

 

 


<

 

style type="text/css">

 

 

.RadTreeView .rtPlus

 

{

 

background-image: url('../Images/Folderclosed.gif') !important;

 

 

height: 10px !important;

 

 

width: 12px !important;

 

}

 

 

.RadTreeView .rtMinus

 

{

 

background-image: url('../Images/Folderopen.gif') !important;

 

 

height: 10px !important;

 

 

width: 12px !important;

 

}

 

 

.RadTreeView .rtLI rtLast

 

{

 

background-image: url('../Images/Closed_folder.gif') !important;

 

 

background-position: 0px 0px !important;

 

 

height: 10px !important;

 

 

width: 10px !important;

 

 

}

 

.RadTreeView .rtMinus:hover

 

{

 

background-position: 0px 0px !important;

 

 

}

 

 

.RadTreeView .rtPlus:hover

 

{

 

background-position: 0px 0px !important;

 

}

 

 

</style>

Regards,
Medac 

 

Genady Sergeev
Telerik team
 answered on 23 Oct 2009
1 answer
116 views
All -

I am attempting to Ajaxify a portion or our application and have hit a wall with the PanelBar control.  I have wired up the Item_Click event and would like the event to be an ajax event.  The PanelBar control exists in a content page inside a master page.  No matter what I try, the event is a traditional postback.  The first place I went to investigate the behavior was the Telerik examples and, sure enough, all of the Telerik examples exhibit the same flicker (Postback).  I've tried adding the control to a RadAjaxManagerProxy and also setting the RegisterWithAjaxManager property to true.  Neither have any noticeable affect.  Is there something painfully obvious that I'm missing?

Any help is greatly appreciated.

Jeff


Simon
Telerik team
 answered on 23 Oct 2009
3 answers
102 views
Match type1 -("My Number")

Hi ..
i am using radtree view in my web page.
 I am adding the nodes manually. I have to bind the No of records for corresponding match. I will be getting the d
ata from stored procedure  for corresponding Match type 1 to Match type 7.
Can i add rad treenode text side by my database Numbers.

Match type1 -("My Number")
Match type1 -("My Number")
Match type2 -("My Number")
Match type3 -("My Number")
Match type4 -("My Number")
Match type5 -("My Number")
Match type6 -("My Number")
Match type7 -("My Number").

Here i am adding Match Type1 as template field. When user clicks on that link it navigates to another page.
How can i do this.

Please give some suggetions.
How can i do ?


<
td width="50%" > 
                    <rad:RadTreeView ID="RadTreeView1" runat="server" DragAndDropBetweenNodes="true" Skin="Vista">  
                     
                     <Nodes> 
                        <rad:RadTreeNode runat="server" Text="Matching Types" Expanded="true">  
                         <Nodes> 
                          <rad:RadTreeNode runat="server" Text="Match Type1" NavigateUrl="../Modules/Search Results.aspx" 
                           ToolTip="click here to see results of this search for  the match type fot this decedent."  > 
                                                     
                          </rad:RadTreeNode> 
                          <rad:RadTreeNode runat="server" Text="Match Type2" NavigateUrl="../Modules/Search Results.aspx" 
                           ToolTip="click here to see results of this search for  the match type fot this decedent." />                         
                          <rad:RadTreeNode runat="server" Text="Match Type3" NavigateUrl="../Modules/Search Results.aspx" 
                           ToolTip="click here to see results of this search for  the match type fot this decedent." /> 
                          <rad:RadTreeNode runat="server" Text="Match Type4" NavigateUrl="../Modules/Search Results.aspx" 
                           ToolTip="click here to see results of this search for  the match type fot this decedent." /> 
                          <rad:RadTreeNode runat="server" Text="Match Type5" NavigateUrl="../Modules/Search Results.aspx" 
                           ToolTip="click here to see results of this search for  the match type fot this decedent." /> 
                          <rad:RadTreeNode runat="server" Text="Match Type6" NavigateUrl="../Modules/Search Results.aspx" 
                           ToolTip="click here to see results of this search for  the match type fot this decedent." /> 
                          <rad:RadTreeNode runat="server" Text="Match Type7" NavigateUrl="../Modules/Search Results.aspx" 
                           ToolTip="click here to see results of this search for  the match type fot this decedent." />                                          
                         </Nodes> 
                        </rad:RadTreeNode>                      
                     </Nodes>                    
                    </rad:RadTreeView> 
                </td> 
Simon
Telerik team
 answered on 23 Oct 2009
2 answers
197 views
Hi guys,

1)
When using an Itemtemplate, shouldn't the selected item keep the text it has in the list?
            <ItemTemplate> 
                <div class="rcbItem"
                    <%#Eval("RefereeFirstName") & " " & Eval("RefereeMidName") & " " & Eval("RefereeLastName")%> 
               </div> 
            </ItemTemplate> 

Now, in the combobox list you get the full names of the referees, while the selected item only displays the first name.

When binding the data I have stated:
combo.DataTextField = "RefereeFirstName"
so in a way this might be normal, but I would think the itemtemplate should override it for the selected item as well as the others.

Not setting the DataTextField only results in the classic system.data.datarowview text being displayed instead.
So, in order to get all the names for the selected item, what would you do?

2)
Another problem I'm getting related to using an itemtemplate is when adding an item dynamically:

combo.Items.Insert(0, New RadComboBoxItem("My Text", 0)) works fine in itself, the item is inserted. But it has no text in the list, while the text is displayed when the item is selected.

I am using Q1 2009.

Regards,
-DJ-


-DJ-
Top achievements
Rank 1
 answered on 23 Oct 2009
2 answers
562 views
Hi there.

I got a problem that the OnTextChanged-Event from the radEditor does not work as expected. I got this following Code-Snippet:
      <asp:Label SkinID="mailLabel" ID="lblMailRcp"  runat="server"   Font-Bold="true"  Text="<%$Resources:TextResources, ID_MAIL_TO%>" />&nbsp;</td><td width="650"><telerik:RadTextBox OnTextChanged="anyText_TextChanged" ID="txtMailTo" Font-Size="10" runat="server"  ReadOnly="true" Width="100%"  AutoPostBack="true"></telerik:RadTextBox> 
 
        <telerik:RadEditor ID="EditorMailBody" runat="server" EditModes="Design" OnTextChanged="anyText_TextChanged"  AutoPostBack="true" 
               Enabled="True" EnableResize="True" Language="de-DE"  
               ToolsFile="~/App_GlobalResources/NoTools.xml" Visible="True"                 
               Width="100%" Height="275" SkinID="EmailEditor"  
               ><Content /></telerik:RadEditor> 

This is within a RadAjaxPanel.

Now my event-handler (opened by every radtextbox and the radeditor) looks this way:
protected void anyText_TextChanged(object sender, EventArgs e) 
        { 
            if (sender is RadTextBox) 
            { 
                RadTextBox selBox = (RadTextBox)sender; 
                switch (selBox.ID) 
                { 
                    case "txtMailTo"
                        _currentEmail.Recipient = selBox.Text; 
                        break
                    case "txtMailSubject"
                        _currentEmail.Subject = selBox.Text; 
                        break
                    case "lblMailSender"
                        _currentEmail.Sender = selBox.Text; 
                        break
                } 
            } 
            else if (sender is RadEditor) 
            { 
                RadEditor selBox = (RadEditor)sender; 
                switch (selBox.ID) 
                { 
                    case "EditorMailBody"
                        _currentEmail.Body = selBox.Text; 
                        break
                } 
            } 
            _currentEmail.UpdateEmail(); 

Now the following happens:
When I change a Text in RadTextbox and leave it the event is fired and anyText_Changed is run (like expected)

But when I change the text in the RadEditor nothing happens.
When after editing some Text in the RadEditor I change the Text of a radTextbox and then reactivate the radEditor (by clicking into it) the event from the Textbox AND from the radEditor is fired (jumping into the else if - part)

So it looks like the OnTextChanged-Event from radEditor does not initiate a Postback.

Any clue?
LeBear
Top achievements
Rank 1
 answered on 23 Oct 2009
7 answers
539 views
                            <telerik:RadGrid runat="server" AllowPaging="True" ID="grdAddedFlyerItems" OnNeedDataSource="grdAddedFlyerItems_NeedDataSource" 
                                Width="375px" OnRowDrop="grdAddedFlyerItems_RowDrop" AllowMultiRowSelection="true" 
                                PageSize="7" AutoGenerateColumns="false">  
                                <MasterTableView DataKeyNames="ItemID" Width="100%" EditMode="InPlace">  
                                    <EditFormSettings> 
                                        <EditColumn UniqueName="EditCommandColumn1" ButtonType="imageButton" CancelText="Cancel this action" 
                                            UpdateText="Save changes" EditText="Edit record" CancelImageUrl="~/App_Themes/Default/Buttons/notapprovedicon.gif" 
                                            UpdateImageUrl="~/App_Themes/Default/Buttons/saveicon.gif">  
                                        </EditColumn> 
                                    </EditFormSettings> 
                                    <Columns> 
                                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" 
                                            EditImageUrl="~/App_Themes/Default/Buttons/editicon.gif">  
                                            <ItemStyle CssClass="nowrap" /> 
                                            <HeaderStyle Width="10px" /> 
                                        </telerik:GridEditCommandColumn> 
                                        <telerik:GridButtonColumn ButtonType="ImageButton" ConfirmText="Remove this item from added items?" 
                                            CommandName="RemoveItem" Text="Remove Item" UniqueName="DeleteColumn" ImageUrl="~/App_Themes/Default/Buttons/recyclebin_small.gif">  
                                            <HeaderStyle Width="10px" /> 
                                        </telerik:GridButtonColumn> 
                                        <telerik:GridBoundColumn DataField="ItemCompany" HeaderText="Prefix" SortExpression="ItemCompany" 
                                            UniqueName="ItemCompany" ReadOnly="true">  
                                            <HeaderStyle Width="35px" /> 
                                            <ItemStyle CssClass="nowrap" /> 
                                        </telerik:GridBoundColumn> 
                                        <telerik:GridBoundColumn HeaderText="Item Nbr" SortExpression="ItemNumber" DataField="ItemNumber" 
                                            UniqueName="ItemNumber" ReadOnly="true">  
                                            <HeaderStyle Width="65px" /> 
                                            <ItemStyle CssClass="nowrap" /> 
                                        </telerik:GridBoundColumn> 
                                        <telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description" 
                                            UniqueName="Description" ReadOnly="true">  
                                        </telerik:GridBoundColumn> 
                                        <telerik:GridNumericColumn DataField="Price" HeaderText="Price" DataFormatString="{0:C}" 
                                            SortExpression="Price" UniqueName="Price" /> 
                                    </Columns> 
                                    <NoRecordsTemplate> 
                                        <div style="height: 30px; cursor: pointer;">  
                                            No items to view</div> 
                                    </NoRecordsTemplate> 
                                    <PagerStyle Mode="NumericPages" PageButtonCount="4" /> 
                                </MasterTableView> 
                                <ClientSettings AllowRowsDragDrop="True">  
                                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" /> 
                                    <ClientEvents OnRowDropping="onRowDropping" /> 
                                </ClientSettings> 
                            </telerik:RadGrid> 
 


It works fine if I take out EditForms="InPlace" in the MasterTableView but it seems like there should be a way to customize these icons easily when using InPlace edit mode.

Thanks,
Andy
Sebastian
Telerik team
 answered on 23 Oct 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
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
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?