This is a migrated thread and some comments may be shown as answers.

a gridview with combobox in user control issue

5 Answers 96 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Daniel Kuo
Top achievements
Rank 1
Daniel Kuo asked on 15 Sep 2008, 06:23 AM
Hi :

I got a strange error message about a gridview with combobox in user control issue

we use combobox in user control, then we put the user control in gridview

this is the user control(ASCX) code fragment

<%@ Control Language="C#" AutoEventWireup="true" Codebehind="UC062.ascx.cs" Inherits="VMI.Web.Controls.UC062" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<telerik:RadCodeBlock ID="RCB1" runat="server">
<script type="text/javascript" language="javascript">
       function RadComboBox2_OnClientFocus() {
       }
</script>

<table cellspacing="0" cellpadding="0" border="0">
    <tr>
        <td width="10%">
                <telerik:RadComboBox ID="RadComboBox2" runat="server"
                EnableLoadOnDemand="True"                      
                HighlightTemplatedItems="True"
                ItemRequestTimeout="500"
                AllowCustomText="True"
                NoWrap ="true"
                ShowWhileLoading ="true"
                Height="100%"
                DropDownWidth="180px"
                MarkFirstMatch="True"           
                OnItemDataBound="RadComboBox2_ItemDataBound"  
                OnItemsRequested="RadComboBox2_ItemsRequested"               
                OnClientFocus="RadComboBox2_OnClientFocus" 
                                          
                OnLoad="RadComboBox2_Load" 
                OnSelectedIndexChanged="RadComboBox2_SelectedIndexChanged"
                ShowToggleImage="False"                
                Skin="Inox">               
                             
                </telerik:RadComboBox>
                            
                </td>
   </tr>
</table>

this is ASPX Page code fragment

<asp:GridView ID="dgiPipeLineItem" CssClass="cellPadding" runat="server" AutoGenerateColumns="False"
                        Width="100%" meta:resourcekey="dgiPipeLineItemResource1" BorderWidth="1" BorderColor="#cacaca"
                        OnRowDataBound="dgiPipeLineItem_RowDataBound" OnRowCancelingEdit="dgiPipeLineItem_RowCancelingEdit"
                        OnRowEditing="dgiPipeLineItem_RowEditing" DataKeyNames="ID" OnRowUpdating="dgiPipeLineItem_RowUpdating">
                        <HeaderStyle CssClass="Td_UpdateForm_Field3" />
                        <RowStyle CssClass="table_11" />
                        <AlternatingRowStyle CssClass="table_10" />
                        <Columns>
                            <asp:TemplateField HeaderText="xxx" meta:resourcekey="TemplateFieldResource2">
                                <ItemStyle HorizontalAlign="Left" />
                                <EditItemTemplate>
                                    <uc3:UC062 ID="uc_SupportDeptEdite" runat="server"  OnSelectedIndexChanged="uc_SupportDeptEdite_OnSelectedIndexChanged" />
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblSupportDept" runat="server" Text='<%# Eval("SupportDeptName") %>'></asp:Label>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <uc3:UC062 ID="uc_SupportDeptFooter" runat="server" OnSelectedIndexChanged="uc_SupportDeptFooter_OnSelectedIndexChanged" />
                                </FooterTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>


when the page loaded

we got a java script error in vs2008: Microsoft JScript 執rumtime error: 'RadComboBox2_OnClientFocus' undefined

but we found other server side combobox event is ok. only the client side event (in this example, OnClientFocus event).

Can you help us with this issue?

thanks 

regards
  

5 Answers, 1 is accepted

Sort by
0
Daniel Kuo
Top achievements
Rank 1
answered on 15 Sep 2008, 06:26 AM
Hi it me again :

please ignore OnSelectedIndexChanged="uc_SupportDeptFooter_OnSelectedIndexChanged"
 in ASPX page.

regards,

Lu
0
Daniel Kuo
Top achievements
Rank 1
answered on 15 Sep 2008, 06:30 AM
Hi :

sorry i forgot to provide the r.a.d version we used:
we use R.A.D 2008 Q2 SP1

regards
0
Veselin Vasilev
Telerik team
answered on 16 Sep 2008, 09:18 AM
Hi Daniel Kuo,

Please try the following:

1. Put the closing tag of RadCodeBlock. You need to close it after the javascript
2. Add parameters to the event handler

<telerik:RadCodeBlock ID="RCB1" runat="server"
<script type="text/javascript" language="javascript"
       function RadComboBox2_OnClientFocus(sender, eventArgs) { 
       } 
</script> 
</telerik:RadCodeBlock> 

Let us know how it goes.

All the best,
Veskoni
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Daniel Kuo
Top achievements
Rank 1
answered on 16 Sep 2008, 01:52 PM
Hi:

we had following your instruction and still no luck.

I had create a support ticket with a sample project to demostrate this issue.

Please help us ASAP.

BTW, My ticket ID is : 162208

thanks in advance.

Regards
0
Veselin Vasilev
Telerik team
answered on 19 Sep 2008, 12:02 PM
Hello Daniel Kuo,

Thank you for the provided project. It helped us identify the problem and the solution.

What you need to do is to replace the RadCodeBlock with RadScriptBlock in your web user control as below:

<telerik:RadScriptBlock ID="RCB1" runat="server"
    <script type="text/javascript" language="javascript"
        function RadComboBox2_OnClientFocus(sender, eventArgs) { 
            alert("on focus"); 
        } 
    </script> 
</telerik:RadScriptBlock

I hope this helps.

All the best,
Veskoni
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Daniel Kuo
Top achievements
Rank 1
Answers by
Daniel Kuo
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or