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

I am using a RadComboBox in an EditItemTemplate of a GridTemplateColumn (in a Detail Table). How do I wire it to use the ItemsRequested event? I have tried wiring it in the RadGrid ItemDataBound event but the ItemsRequested event is never fired. I have set the  EnableLoadOnDemand property to true. I am using RadGrid 5.1.1.0 .

Regards,

James


RadComboBox combo2 = (RadComboBox)e.Item.FindControl("RadComboBox2");
            combo2.ItemsRequested += this.list_ItemsRequested;

RadComboBox combo2 = (RadComboBox)e.Item.FindControl("RadComboBox2");
            combo2.ItemsRequested += this.list_ItemsRequested;


                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="RadComboBox2" AppendDataBoundItems="true" Height="200px" runat="server" Skin="WebBlue"  
                                    DataTextField="Temp" DropDownWidth="400px" DataValueField="Code" AllowCustomText="true" MarkFirstMatch="false" 
                                    SelectedValue='<%# Bind("SAPCode")%>' Sort="Ascending" Filter="Contains" HighlightTemplatedItems="True" EnableLoadOnDemand="true">   

<EditItemTemplate> 
                                <telerik:RadComboBox ID="RadComboBox2" AppendDataBoundItems="true" Height="200px" runat="server" Skin="WebBlue"  
                                    DataTextField="Temp" DropDownWidth="400px" DataValueField="Code" AllowCustomText="true" MarkFirstMatch="false" 


  <telerik:GridTemplateColumn HeaderText="SAP Code" UniqueName="SAPCode">  
                          <HeaderTemplate> 
                                        <table style="font-size:11px"> 
                                            <tr> 
                                                <td style="width: 100px;">Code</td> 
                                                <td style="width: 200px;">Info</td> 
                                            </tr> 
                                        </table> 
                            </HeaderTemplate>
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="RadComboBox2" AppendDataBoundItems="true" Height="200px" runat="server" Skin="WebBlue"  
                                    DataTextField="Temp" DropDownWidth="400px" DataValueField="Code" AllowCustomText="true" MarkFirstMatch="false" 
                                    SelectedValue='<%# Bind("SAPCode")%>' Sort="Ascending" Filter="Contains" HighlightTemplatedItems="True" EnableLoadOnDemand="true">   
Princy
Top achievements
Rank 2
 answered on 28 Oct 2010
2 answers
107 views
I have a page with with various input fields and  3 RadComboBox's. They are pre-populated with data  in the .cs code page

I want to modify the page so that when the user changes the first RadComboBox, the other 2 are updated based on the selection made in the first.   Any help.

.aspx.ca  code

//Page event, raised on page load
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {  
     //Code pre-populated here. no problems.
}


.aspx page code

<tr runat="server" id="Tr1">
            <td style="width: 120px;">Your PI/Approver
                <asp:CompareValidator ID="piCompareValidator" runat="server" Text="*" ControlToValidate="piRadComboBox1" ValueToCompare="Select One..." Operator="NotEqual" ErrorMessage="Please select your P.I. in the 'Order Preferences' section"></asp:CompareValidator>
            </td>
            <td>
                <telerik:RadComboBox ID="piRadComboBox1" Skin="Gray" Height="300px"
                    Width="202px" DataTextField="ListName" DataValueField="UserName" AppendDataBoundItems="true" EnableTextSelection="false" runat="server">
                    <items>
                        <telerik:RadComboBoxItem Text="Select One..." Value="Select One..." />
                    </items>
                </telerik:RadComboBox>
                 <a href="#" rel="1" title="This order requires multiple approvers, add another." class="bdrLink jAdd">+ Add another PI/Approver</a> </td>
    </tr>
    <tr runat="server" id="Tr2">
            <td>Your Approver</td>
            <td>
                <telerik:RadComboBox ID="piRadComboBox2" Skin="Gray" Height="300px" Width="202px" DataTextField="ListName" DataValueField="UserName" AppendDataBoundItems="true" EnableTextSelection="false" runat="server">
                    <items>
                        <telerik:RadComboBoxItem Text="Select One..." Value="Select One..." />
                    </items>
                </telerik:RadComboBox>
 
                 <a href="#" rel="2" class="jRemove bdrLink">Remove</a> </td>
    </tr>
        <tr class="alt">
            <td style="width: 120px;">Your Purchaser </td>
            <td>
                <telerik:RadComboBox ID="purchaserRadComboBox" Skin="Gray" Width="202px" DataTextField="ListName" DataValueField="UserName" AppendDataBoundItems="true" EnableTextSelection="false" runat="server">
                    <items>
                        <telerik:RadComboBoxItem Text="Select One..." Value="Select One..." />
                    </items>
                </telerik:RadComboBox>
                <asp:CompareValidator ID="purchaserCompareValidator" runat="server" Text="*" ControlToValidate="purchaserRadComboBox" ValueToCompare="Select One..." Operator="NotEqual" ErrorMessage="Please select your purchaser in the 'Order Preferences' section"></asp:CompareValidator>
            </td>
        </tr>


Yana
Telerik team
 answered on 28 Oct 2010
2 answers
118 views
Hi,
In Radgrid  have onRowDatabound like feature.
actually i want to make a calculation inside gridview with two column and output should come in third column.
and here i also want to use javascript/jquery.
if there are any sample or demo please let me know..


sorry for inconvenience my subject line is below there are typing mistake in my subjec line. 

calculate total=quantity*price



thanks
Shivesh
shivesh
Top achievements
Rank 1
 answered on 28 Oct 2010
1 answer
51 views


the control
<telerik:RadComboBox ID="RadComboBox3" runat="server" Width="500px" Height="150px" Skin="Hay"
                OnClientSelectedIndexChanged="catchSelected" ChangeTextOnKeyBoardNavigation="false"
                Filter="Contains" EnableAutomaticLoadOnDemand="true"
                EmptyMessage="Chose a product.." ShowMoreResultsBox="true" ItemsPerRequest="10" ExpandAnimation-Type="InQuad"
                EnableVirtualScrolling="true">
                <WebServiceSettings Method="GetProductNames" Path="Products.asmx" />
            </telerik:RadComboBox>

and the client function:
function catchSelected(sender, evntArgs) 
        {
            var cmb = $telerik.findComboBox('RadComboBox3');
            var chosen = cmb.get_selectedItem();
            if (chosen) {
                alert(chosen.get_text());
            }
        }


The problem:
i can not determine the selected item if user presses "enter key" on an item, instead of clicking the mouse on that item.
because when ChangeTextOnKeyBoardNavigation is false, Combobox does not change the input box.

do you know how can i find the selected item on pressing the enter key when ChangeTextOnKeyBoardNavigation is false ? 
Yana
Telerik team
 answered on 28 Oct 2010
1 answer
135 views
Im using  a FormTemplate like this

<EditFormSettings EditFormType="Template">
         <FormTemplate>
                    Codigo:
                    <asp:TextBox Width="135" ID="CodigoTextBox" runat="server" Text='<%# Bind("Codigo") %>'>
                    </asp:TextBox>
                    Ordem<asp:TextBox ID="OrdemTextBox" runat="server" Text='<%# Bind("Ordem") %>'>
                    </asp:TextBox>

                    <asp:ImageButton ID="objImaInserir" runat="server" ImageUrl="~/Images/InserirEditar.gif"
                         Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' CommandName='<%#        (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />

                       <asp:ImageButton ID="objBtnCancel" CausesValidation="False" runat="server" ImageUrl="~/Images/Cancel.gif" Text="Cancel" CommandName="Cancel" />
                </FormTemplate>
 </EditFormSettings>


The field Ordem is a nullable  integer, is not required, so when i dont fill the text box
i get this error.
Failed to set one or more properties on type ERC.DAL.Objecto.   is not a valid value for Int32.

Im using automatic updates and inserts.
If i put the text box in a GridTemplateColumn
like this
  <telerik:GridTemplateColumn DataField="Ordem" HeaderText="Ordem" SortExpression="Ordem"
                    UniqueName="Ordem">
                    <EditItemTemplate>
                        <asp:TextBox ID="OrdemTextBox" runat="server" Text='<%# Bind("Ordem") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="OrdemLabel" runat="server" Text='<%# Eval("Ordem") %>'></asp:Label>
                    </ItemTemplate>
  </telerik:GridTemplateColumn>

  i dont get this error anymore
 
 
Veli
Telerik team
 answered on 28 Oct 2010
4 answers
101 views
Hi,

I've just started up a new web project using the Rad Controls template.
In the wizard, I chose the black skin.

I cannot see the folder in solution explorer for that skin or any style sheets.
I have deduced that the skin is embedded as a web resource.

What options to I have for styling my site? With the skin embedded away, there's no transparency of styles. I'm not sure how to work in with this "styling framework".
Yana
Telerik team
 answered on 28 Oct 2010
1 answer
153 views
code is below. it works fine for edit, but errors on insert when it tries to bind the date control. text control work fine.
  

<EditFormSettings InsertCaption="Add new Comment" CaptionFormatString="Edit Comment: {0}"
                                    CaptionDataField="CultivarCommentsID" EditFormType="Template" ColumnNumber="2">
                                    <FormTemplate>
                                        <table id="Table1" cellspacing="1" cellpadding="1" border="0">
                                            <tr>
                                                <td>
                                                    Date:
                                                </td>
                                                <td>
                                                    <telerik:RadDatePicker Skin="Forest" ID="dtpCommentDate" runat="server" SelectedDate='<%# Bind( "Date" ) %>'></telerik:RadDatePicker>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    User:
                                                </td>
                                                <td>
                                                    <telerik:RadTextBox Skin="Forest" ID="txtCommentUser" runat="server" Text='<%# Bind( "UserName") %>' Width="325" TabIndex="1">
                                                    </telerik:RadTextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    Comment:
                                                </td>
                                                <td>
                                                    <telerik:RadTextBox Skin="Forest" ID="txtComment" runat="server" Text='<%# Bind( "Comments") %>' Width="325" TabIndex="2" Rows="6" TextMode="MultiLine">
                                                    </telerik:RadTextBox>
                                                </td>
                                            </tr>
                                        </table>
                                        <table style="width100%">
                                            <tr>
                                                <td align="right" colspan="2">
                                                    <asp:Button ID="Button1" Text='<%# Iif (TypeOf Container is GridEditFormInsertItem, "Insert", "Update") %>'
                                                        runat="server" CommandName='<%# Iif (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'>
                                                    </asp:Button>&nbsp;
                                                    <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                                    </asp:Button>
                                                </td>
                                            </tr>
                                        </table>
                                    </FormTemplate>
                                </EditFormSettings>
Princy
Top achievements
Rank 2
 answered on 28 Oct 2010
4 answers
87 views
I have a RadGrid with a GridDateTimeColumn.  In the RadGrid1_ItemDataBound event handler, I am configuring the DatePicker.ShareCalendar.  The markup for the grid and the event handler are shown at the end of the post.

Note that I am setting the datepicker.SharedCalendar.FastNavigationStep = 12, so that the FastNavigation should jump by 12 months.

However, it still jumps by the default 3 months.  The FastNavigationStep property update is not taking.  Incidentally, the FastNavigationPreviousToolTip and FastNavigationNextToolTip are not taking either.

Any help would be appreciated.

Code:

         <telerik:RadGrid ID="grdFamily" runat="server" DataSourceID="ldsUserFamilyMembers" Skin="Vista"    Width="500px"
                 AutoGenerateColumns="false" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true"
                    GridLines="None" PageSize="5" OnItemDataBound="RadGrid1_ItemDataBound"
                    AllowPaging="True"  >
                   
                    <MasterTableView DataKeyNames="pk_user_family_member"  TableLayout="Fixed" CommandItemDisplay="Top"  DataSourceID="ldsUserFamilyMembers" Width="500px">
                        <Columns>
                        ...
                        <telerik:GridDateTimeColumn  DataField="birth_date" PickerType="DatePicker" DataFormatString="{0:MMM dd, yyyy}" HeaderText="Birth Day" >
                            </telerik:GridDateTimeColumn>
                       ...

                        </Columns>
                        <EditFormSettings>
                            <EditColumn ButtonType="ImageButton" />
                        </EditFormSettings>
                    </MasterTableView>
                </telerik:RadGrid>

 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem && e.Item.IsInEditMode)
            {
                GridEditableItem item = (GridEditableItem)e.Item;
                RadDatePicker datepicker = (RadDatePicker)item["DateTimeColumn"].Controls[0];
                datepicker.SharedCalendar.FastNavigationStep = 12; 
                datepicker.SharedCalendar.FastNavigationNextToolTip = "Next Month";
                datepicker.SharedCalendar.FastNavigationPrevToolTip = "Previous Month";
            }
        }

Barry
Top achievements
Rank 1
 answered on 27 Oct 2010
2 answers
64 views
Hi Guys,

I am trying to disable a column when I click on "Edit" command. In my grid, the Edit command is autogenerated and columns are also autogenerated.

I want to disable a column when I click on "Edit" link. However, the column remains enabled and editable. Can anyone please let me know what am I doing wrong. Following is the code:

 

 

protected void RadGrid_EditCommand(object sender, GridCommandEventArgs e)

{

 

 

    GridDataItem dataItem = e.Item as GridDataItem 

 

 

    var column = RadGrid.MasterTableView.AutoGeneratedColumns.First(i => i.HeaderText == "Name");  

    dataItem[column].Enabled = 

 

false;  

 

 

}

 

 

Bhavik
Top achievements
Rank 1
 answered on 27 Oct 2010
0 answers
44 views
Hi,
I am using a telerik combobox, which am binding at the code behind using an SP.
When I use this attribute "ShowMoreResultsBox" , and on rendering  when i click on the button that appears at the foot of the drop down of  the combobox as a result of adding this attribute , the number of items in the combobox increase as the items get repeated as you click 
 Pl suggest.
rajani
Top achievements
Rank 1
 asked on 27 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?