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

Cascading comboboxes in RADGRID edit form

35 Answers 792 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reda
Top achievements
Rank 1
Reda asked on 01 Oct 2008, 02:32 PM
Hello everyone,

Can some one please help in solving this issue, I have a radgrid and using automatic updating/deleting/inserting and also using "edit form" provided by the grid. I have 2 comboboxes in my editform that i would like them to be related to each other. One combobox is the country the other is "state/province" depending if ur in Canada or the US. So if u select the country then the other combobox gets filled with appropriate values. I have looked every where and can't find a solution.

Thanks in advance for any help.

Reda.

35 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 01 Oct 2008, 02:41 PM
Hi Reda,

Here is an example of inter-related RadComboBoxes:

http://demos.telerik.com/aspnet/prometheus/ComboBox/Examples/Functionality/MultipleComboBoxes/DefaultCS.aspx


All the best,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Reda
Top achievements
Rank 1
answered on 01 Oct 2008, 02:50 PM
Thanks for the reply,

The thing is I know how to connect 2 combo boxes but having difficulties inside the edit form of the RADGRID. Any suggestions would be greatly appreciated.

Thanks

Reda
0
Dio
Top achievements
Rank 1
answered on 01 Oct 2008, 03:52 PM
I have the same problem

Telerik Team

The problem is perform that in EDIT MODE

using ClientSide Scripts

Thanks




0
Reda
Top achievements
Rank 1
answered on 01 Oct 2008, 03:57 PM
There must be some other way to perform this without using client side scripts?
0
Dio
Top achievements
Rank 1
answered on 02 Oct 2008, 08:06 PM
I belive so

im looking in this thread
http://www.telerik.com/community/forums/thread/b311D-bgdcbm.aspx


its the same problem

i trying to use their solution

if i maded it
 I try to do a simple sample e post it here!
0
Reda
Top achievements
Rank 1
answered on 07 Oct 2008, 08:57 PM
Please Telerik team help me out with this problem....
0
Yavor
Telerik team
answered on 08 Oct 2008, 05:35 AM
Hi Reda,

You can correlate the combos as shown in the code sample below:

.aspx
  <telerik:GridTemplateColumn UniqueName="TemplateColumn">  
                    <ItemTemplate> 
                    test  
                    </ItemTemplate> 
                    <EditItemTemplate> 
                    <telerik:RadComboBox runat="server" ID="combo1" AutoPostBack="true" 
                     DataSourceID="AccessDataSource2" DataTextField="EmployeeID"   
                    DataValueField="EmployeeID" OnSelectedIndexChanged="combo1_SelectedIndexChanged">  
                    </telerik:RadComboBox> 
                    <telerik:RadComboBox runat="server" ID="combo2" 
                    DataSourceID="AccessDataSource2" DataTextField="EmployeeID"   
                    DataValueField="EmployeeID">  
                    </telerik:RadComboBox> 
                    </EditItemTemplate> 
                      
                    </telerik:GridTemplateColumn> 

.cs
protected void combo1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)  
    {  
        ((o as RadComboBox).NamingContainer.FindControl("combo2") as RadComboBox).SelectedIndex=(o as RadComboBox).SelectedIndex;  
    } 

I hope this helps.

Sincerely yours,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Reda
Top achievements
Rank 1
answered on 14 Oct 2008, 04:33 PM
That did not help because my drop down boxes are in an automatically created "edit form" by the grid. Any other solutions will be greatly appreciated?

Thanks in advance.... 
0
Princy
Top achievements
Rank 1
answered on 15 Oct 2008, 04:20 AM
Hello Reda,

I suppose that you would be using DropDownColumns in your grid. If so, you can access the dropdownlist in the editform for a column and then create its SelectedIndexChangedEventHandler  as shown in the code below.
cs:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
            { 
                 
                DropDownList ddlist = (e.Item as GridEditableItem)["Country"].Controls[0] as DropDownList; 
                
                ddlist.AutoPostBack = true
                ddlist.SelectedIndexChanged += new EventHandler(ddlist_SelectedIndexChanged); 
            } 
        } 


To access the second dropdown in the EditForm on the SelectedIndexChanged event of the first dropdown you need to reference the edited grid item through the NamingContainer attribute of the first dropdown and then access the controls collection of the edited item as shown below.
cs:
 void ddlist_SelectedIndexChanged(object sender, EventArgs e) 
    { 
          
            GridEditableItem editedItem = (sender as DropDownList).NamingContainer as GridEditableItem;          
           DropDownList ddList2 = editedItem["State"].Controls[0] as DropDownList; 
 
            // change the data source for ddList2 with custom code here       
           
    } 

A similar scenario is also demonstrated in this online demo link.

Thanks
Princy.
0
Reda
Top achievements
Rank 1
answered on 15 Oct 2008, 03:36 PM
Thank you for ur reply, I had allready checked out that demo and fixed the problem only in the edit mode. If i want to add new record not working.

Any Help?

Thanks in advance.........
0
Reda
Top achievements
Rank 1
answered on 16 Oct 2008, 05:40 PM
Can someone plz help me?

The suggestion above works only in edit command of the grid, if i want to add new record the cascading drop down list not populating based on what is chosen!!!

Thanks in advance....
0
Yavor
Telerik team
answered on 17 Oct 2008, 06:01 AM
Hi Reda,

This is because the combo handler is not attached when inserting a new record. The code attached only checks for (e.Item is GridEditableItem && e.Item.IsInEditMode) which would correcspond to an item in edit mode.
You can also add another check to veryfy if e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted to ensure you cater for the case when you are inserting an item.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Reda
Top achievements
Rank 1
answered on 17 Oct 2008, 02:41 PM
Do I have to put that check in the "ItemCreated" event handler of the grid?

 

0
Yavor
Telerik team
answered on 20 Oct 2008, 07:47 AM
Hi Reda,

This can also be done in the ItemDataBound event handler of the control.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Reda
Top achievements
Rank 1
answered on 21 Oct 2008, 02:43 PM
Thanks for the reply....

I tried putting it into the "ItemDataBound" and its not working, it does an autopostback but the second drop down not getting filled properly.

Here is the code:

Dim

 

currentTable As GridTableView = e.Item.OwnerTableView
Dim tableName As String = e.Item.OwnerTableView.Name

 

 

'Check to see if in insert mode
If (TypeOf e.Item Is GridEditFormInsertItem AndAlso e.Item.OwnerTableView.IsItemInserted) Then

'
the item is in insert mode
Dim editedItem As GridEditFormInsertItem = CType(e.Item, GridEditFormInsertItem)

 

 

If tableName = "Master" Then
    'Country(Combobox)
    Dim ComboCountry As DropDownList = CType(editedItem("CountryID").Controls    (0),     DropDownList)

 

 

    'Attach SelectedIndexChanged event for the Country Combobox    control
    
ComboCountry.AutoPostBack = True
    AddHandler ComboCountry.SelectedIndexChanged, AddressOf
    Me.ComboCountry_SelectedIndexChanged
End If
End If

Not sure if i'm doing anything wrong?

Thanks in advance,

Reda

 

0
Michael
Top achievements
Rank 1
answered on 22 Oct 2008, 04:37 PM
Hi Reda,

I believe that we are facing a similar issue. If you look at the sample code (in C#) posted on the following thread, you will see that cascading comboboxes work quite well in EDIT mode.

http://www.telerik.com/community/forums/thread/b311D-bebtae.aspx

Like you, we discovered that the sample code does not work when in INSERT mode. With much hope and anticipation, I tried out the suggestion from this thread. Sadly, attaching the event handler this way makes no difference.

My tests (using C#) have shown the event handler will be attached and fire using either set of conditions (converted to VB for this post):

If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then

OR

If (TypeOf e.Item Is GridEditFormInsertItem AndAlso e.Item.OwnerTableView.IsItemInserted) Then


When stepping through the code, I find the problem relates to databinding within the event handler, not when/how the event handler is attached. When DataBind is called on the combobox in the OnSelectedIndexChanged event handler AFTER the DataSource has been assigned to the correct values from the database, the DataSource reverts to the previous values. The cascade effect occurs, but it is one cycle behind the user selection and subsequent data access.

For example, the page loads with United States selected as the Country and the State combobox listing the correct values for the United States. First, we select Canada as the new Country. The event handler fires, the correct data is retreived from the database, databind is called and yet the State combobox still shows data from the United States. Second, when we select Mexico as the new Country, the Canadian states/provinces finally show up in the State combobox.

We have experimented with several "interpretations" of the sample code and have not found a solution to this issue yet.

Thanks,

Michael
0
Yavor
Telerik team
answered on 23 Oct 2008, 07:04 AM
Hi Michael,

Attached to this message, is a small application, which handles the desired setup. It also uses client side handling to set the selected index of the related combo.
I hope this gets you started proper.

Sincerely yours,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael
Top achievements
Rank 1
answered on 23 Oct 2008, 04:53 PM
Hi Yavor,

Thank you for taking a look at this issue. Unfortunately, there is a small misunderstanding regarding what the issue actually is. Your sample code solves a problem other than the one we have. In your sample, javascript on the client selects the same index in the second drop-down column as the item selected in the first drop-down column.

I (like Reda and perhaps others) am working on an address form where the correct list of states/provinces should be displayed based on the country selected. There is sample code (provided by Telerik) that works when editing an existing record using the built-in edit form, but it does not work when inserting a new record.

In my tests of both the sample code and our own implementation, the event handler fires, the correct data is retreived from the database, and that data is assigned to the data source for the second drop-down. The failure occurs when DataBind is called on the second drop-down immediately after the data source is assigned to the new data.

Here are the steps to reproduce the issue:

  1. Download the following code sample from Telerik: http://www.telerik.com/ClientsFiles/087586_CascadingCombosInGridEditMode.zip
  2. Enable inserting
  3. Run the sample
  4. When editing an existing record, change selection of "Order ID" drop-down and note that the values listed in the "Quantities in stock" drop-down change.
  5. When adding a new record, change selection of "Order ID" drop-down and note that the values listed in the "Quantities in stock" drop-down do not change as they do when editing a record. THIS is the issue. The second drop-down should be loaded with new data.

Here is a link to the live demo of the sample code for anyone researching a similar issue:
http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Programming/AccessingCellsAndRows/DefaultCS.aspx

Thanks,

Michael

0
Reda
Top achievements
Rank 1
answered on 23 Oct 2008, 05:43 PM
Well put Michael, this issue has been haunting me for the last few days...
0
Yavor
Telerik team
answered on 27 Oct 2008, 12:22 PM
Hello Reda,

Indeed, the behavior that you described is observed.
I will review it in greater details, and update this thread as needed.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Accepted
Yavor
Telerik team
answered on 27 Oct 2008, 01:16 PM
Hello Reda,

After further detailed review on the case, it seems that the comboBox is not properly databound in case it is nested in an insert item form. To work-around this behavior, you can iterate through the items returned in the datatable (datasource for the combo), adding each item to the combo.
Adding an item to the combo may look like this:

.cs
   void list_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)  
        {  
            //first reference the edited grid item through the NamingContainer attribute  
            GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem;  
 
            //the dropdown list will be the first control in the Controls collection of the corresponding cell  
            //for custom edit forms (WebUserControl/FormTemplate) you can find the column editor with the FindControl(controlId) method  
 
            RadComboBox ddList = editedItem["ddlQuantity"].Controls[0] as RadComboBox;              
            //GridDropDownListColumnEditor editor = editedItem.EditManager.GetColumnEditor("ddlQuantity") as GridDropDownListColumnEditor;  
 
              
            // change the data source for ContactTitle with custom code here  
            DataTable table = GetRelatedRecords("SELECT OrderID, Quantity FROM [Order Details] WHERE OrderID = " + (editedItem["ddlOrderID"].Controls[0] as RadComboBox).SelectedValue);  
                       
            ddList.DataBind();  
            ddList.Items.Clear();  
            ddList.Items.Add(new RadComboBoxItem("test"));  
            //ddList.DataBind();  
           // ddList.Items.Add(new ListItem("test"));  
              
            RadGrid1.Controls.Add(new LiteralControl("<b>The available options for 'Quantites in stock' has been changed</b>"));  
        } 

I hope this helps.

Regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael
Top achievements
Rank 1
answered on 28 Oct 2008, 07:00 PM
Hi Yavor,

I have modified our implementation following your suggestion and the cascading effect does work for inserts as well as edits. Looping through the data and adding the items into the Combobox may not be especially elegant, but it is effective. Obviously, we were expecting this functionality to be handled properly by the Grid and/or Combobox controls.

Has this DataBinding bug been added to the list of issues to be addressed in a future release? How soon can we expect to see the issue resolved?

Thanks,

Michael
0
Yavor
Telerik team
answered on 29 Oct 2008, 06:53 AM
Hi Michael,

I have escalated this issue to our developers, and although I cannot commit to a definite timeframe, this will be looked into for sure.
I hope the present work-around is suitable for you.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Reda
Top achievements
Rank 1
answered on 03 Nov 2008, 08:55 PM
Hi Yavor,
 
Sorry I haven't replied in a while but I have been travelling work related for 2 weeks now and finally now i'm at the office. I implemented your solution and it works perfect. It would still be greatly appreciated if the grid would handle that problem automatically. But besides that thanks for your help Yavor and Micheal I appreciated your feedbacks, thanks.

Bye Reda
0
Rajitha Reshmai
Top achievements
Rank 1
answered on 10 Feb 2010, 10:52 AM
How to close the edit mode after  inserting a new record in radgrid
0
Pavlina
Telerik team
answered on 15 Feb 2010, 04:08 PM
Hello Rajitha,

Did you set AllowAutomaticInserts to true? If that is the case, please set it to false. This propertie is used only with datasource controls as shown here.

Additionally, to close the edit mode after  inserting a new record in radgrid you could try the code snippet bellow:
C#
RadGrid1.MasterTableView.IsItemInserted = false;

I hope this helps.

Kind regards,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Jaime Bula
Top achievements
Rank 2
answered on 12 Aug 2010, 07:06 PM
Hi,

Is there an example on how to do this por RadGridView for Silverlight?

Thanx in Advance.

Jaime
0
Dimo
Telerik team
answered on 13 Aug 2010, 09:19 AM
Hello Jaime,

Please refer to:

http://blogs.telerik.com/pavelpavlov/posts/10-01-27/cascading_comboboxes_selection_in_radgridview_for_silverlight_and_wpf.aspx

If you have additional questions, it is preferrable to post a new thread in the Silverlight forum section.

Kind regards,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Balakrishna Reddy
Top achievements
Rank 1
answered on 05 Oct 2012, 07:37 AM
hey
   i also have same problem.if i use like this i am getting an error as
NullReferenceException was not handled by the user code  & Object Reference not set to an instance of an Object.
like this....
so please suggest me how to solve  this problem.


Thanks in advance
0
Balakrishna Reddy
Top achievements
Rank 1
answered on 05 Oct 2012, 01:55 PM
Hello telerik and other people,,please,,
      I have two  GridDropDwonColumns(Country,State) in my Rad Grid .. when i am trying to edit the ROW by clicking on the EDIT button my first(Country) DropDownList will display all the records based on the "countryID"  but i want to display the selected "country Name" as first element and following  other Country Names.
for Ex:i have 
CountryID     CountryName
-------------------------------------
1                      India
2                      Pakistan
3                      China
4                      Japan
------------------------------------------
and i am trying to edit the 2nd Row(2,Pakistan) my DropDownList will displaying as
India
Pakistan
China  .......etc...
----------------------------------------
But i want like.
Pakistan     at first position and followed by other Country Names.
..........
........
.........                                                                                                  
So please help me how to Get this.

                   
0
Shinu
Top achievements
Rank 1
answered on 09 Oct 2012, 05:51 AM
Hi,

Please try the following code snippet I tried to give the selected item in the DropDownlist as the first item.

ASPX:
<telerik:GridDropDownColumn UniqueName="DropDownColumn" DropDownControlType="RadComboBox" DataSourceID="SqlDataSource1" ListTextField="OrderID" ListValueField="OrderID"></telerik:GridDropDownColumn>

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem edit = (GridEditableItem)e.Item;
        RadComboBox combo = (RadComboBox)edit["DropDownColumn"].Controls[0];
        combo.SelectedItem.Text = (string)DataBinder.Eval(e.Item.DataItem, "OrderID").ToString();
    }
}

Thanks,
Shinu.
0
Balakrishna Reddy
Top achievements
Rank 1
answered on 19 Oct 2012, 02:06 PM
Hi,
  i have event handler i want to invoke that one.but not possible to me.
Bellow is my Code......


public delegate void PersonHandler(object sender,EventArgs e);
public event PersonHandler CountrySelectedIndexChange;
public event PersonHandler StateSelectedIndexChange;
public event PersonHandler btnUploadClick;
public event PersonHandler btnSubmitClick;


protected virtual void rcbCountryName_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (this.CountrySelectedIndexChange != null)
        {
            this.CountrySelectedIndexChange(sender, e);
        }
    }
    protected void rcbStateName_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
    {
        if (this.StateSelectedIndexChange != null)
        {
            this.StateSelectedIndexChange(this,e);
        }
    }
********


when i execute the above code i am getting null value from CountrySelectedIndexChange and it did not enter into if Loop......
So please any one help me..


Thanks
0
Balakrishna Reddy
Top achievements
Rank 1
answered on 29 Oct 2012, 06:34 AM
Hi,
   Please anybody Help me.
I am using Rad Grid with web user control in Editformsettings mode as web control..I am using radasyuploader when i am clicking on upload button for updating  i am getting an error saying that :

Insert item is available only when grid is in insert mode.

The following is my MyUserControl.ascx file...

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyUserControl.ascx.cs" Inherits="MyUserControl" %>
<%@ Register  Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>


<style type="text/css">
    .style2
    {
        width: 270px;
    }
    .style3
    {
        width: 272px;
    }
</style>


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


<table width="100%" >
<tr>
<td>
<table id="Table3" cellspacing="1" cellpadding="1" width="100%" border="0">
    <tr>
        <td>
            <h3>Web User Control</h3>
        </td>
    </tr>
    <tr>
        <td class="style3">
            Person ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        
            <telerik:RadTextBox ID="txtPID" runat="server" ReadOnly="true" Text='<%# DataBinder.Eval( Container, "DataItem.PID" ) %>' />
            <br />
            <br />
        </td>
    </tr>
    <tr>
        <td class="style3">
            Person Name &nbsp; &nbsp;&nbsp;
            <telerik:RadTextBox ID="txtPName" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.PName" ) %>' />
            <br />
            <br />
        </td>
    </tr>
    <tr>
        <td class="style3">
            Country Name &nbsp;&nbsp;
            <telerik:RadComboBox ID="rcbCountryName" runat="server" AutoPostBack="true"
                DataMember='<%# DataBinder.Eval( Container, "DataItem.COU_Name" ) %>' DataValueField="COU_Name"
                 DataTextField="COU_Name" Text='<%# DataBinder.Eval( Container, "DataItem.COU_Name" ) %>'
                onselectedindexchanged="rcbCountryName_SelectedIndexChanged" />
            &nbsp;&nbsp;
            <br />
            <br />
        </td>
    </tr>
    <tr>
        <td class="style3">
            State Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <telerik:RadComboBox ID="rcbStateName" runat="server"  AutoPostBack="true"
                DataMember='<%# DataBinder.Eval( Container, "DataItem.STE_Name" ) %>' 
                DataValueField="STE_Name" Text='<%# DataBinder.Eval( Container, "DataItem.STE_Name" ) %>'
                onselectedindexchanged="rcbStateName_SelectedIndexChanged" />
            &nbsp;&nbsp;
            <br />
            <br />
        </td>
    </tr>
    <tr>
        <td class="style3">
            City Name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <telerik:RadComboBox ID="rcbCityName" runat="server"  AutoPostBack="true"
                DataMember='<%# DataBinder.Eval( Container, "DataItem.CIT_Name" ) %>' 
                DataValueField="CIT_Name" 
                Text='<%# DataBinder.Eval( Container, "DataItem.CIT_Name" ) %>' />
            &nbsp;&nbsp;
            <br />
            <br />
        </td>
   </tr>
 </table>
 </td>
 <td>
<table id="Tabl2" cellspacing="1" cellpadding="1" width="100%" border="0">
    <tr>
        <td>
            <telerik:RadAsyncUpload ID="Uplader" runat="server" TargetFolder="Photos"
                    Height="25px" onfileuploaded="Uplader_FileUploaded" Skin="Sunset" 
                Width="243px"/>
            <br />
            <br />
            &nbsp;&nbsp;&nbsp;&nbsp;
            <asp:Button ID="btnUpload" runat="server"  Text="UploadFile"
                    CommandName="PerformInsert" Visible="true" Width="96px" onclick="btnUpload_Click"/>
            <br />
        </td> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
        <td>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <telerik:RadBinaryImage ID="radbinaryimg" runat="server" Height="80px" ImageUrl='<%#"~/Photos/" + Eval("IMG_Name") %>' />
        </td>
    </tr>
   <tr>
    <td class="style2">
        &nbsp;&nbsp;&nbsp;&nbsp;
        Width="89px"/>
        &nbsp;&nbsp;&nbsp;--%>
        <asp:Button ID="btnSubmit" runat="server" CommandName="PerformInsert" 
            Visible="true" Width="96px" onclick="btnSubmit_Click"></asp:Button>
                &nbsp;&nbsp;&nbsp;  
        <asp:Button ID="btnCancel" Text="Cancel" runat="server"  CausesValidation="False" CommandName="Cancel" Width="96px" 
            onclick="btnCancel_Click"></asp:Button>
                     </asp:Button>
            <asp:Button ID="btnInsert" Text="Insert" runat="server" CommandName="PerformInsert"
                Visible='<%# "DataItem" is Telerik.Web.UI.GridInsertionObject %>'></asp:Button>
            &nbsp;
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel"></asp:Button>--%>
    </td>
   </tr>
</table>
</td>
</tr>
</table>

*************************************
and MyUserControlPage.aspx is as follows:
*************************************************

<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>


    <div>
        <telerik:RadGrid ID="RadGrid1" runat="server" 
             AutoGenerateColumns="False" AllowPaging="True" PageSize="5" Skin="Vista" 
            onitemcommand="RadGrid1_ItemCommand" onitemdatabound="RadGrid1_ItemDataBound" onupdatecommand="RadGrid1_UpdateCommand" 
            >
            <PagerStyle Mode="NextPrevAndNumeric" />
            <MasterTableView DataKeyNames="PID" CommandItemDisplay="TopAndBottom">
              <Columns>
                    <telerik:GridEditCommandColumn UniqueName="Editcolumn"></telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn  DataField="PID" ReadOnly ="true" UniqueName="Pid" Visible="false" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="PName" HeaderText="Person Name" UniqueName="PName">
                    </telerik:GridBoundColumn>
                    <telerik:GridDropDownColumn DataField="COU_Name" UniqueName="COU_Name" HeaderText="Country Name" ListDataMember="Country_Master" ListValueField="COU_Name" >
                    </telerik:GridDropDownColumn>
                    <telerik:GridDropDownColumn DataField="STE_Name" UniqueName="STE_Name" HeaderText="State Name" ListDataMember="State_Master" ListValueField="STE_Name" >
                    </telerik:GridDropDownColumn>
                    <telerik:GridDropDownColumn DataField="CIT_Name" UniqueName="CIT_Name" HeaderText="City Name" ListDataMember="City_Master" ListValueField="CIT_Name" >
                    </telerik:GridDropDownColumn>
                    <telerik:GridTemplateColumn HeaderText="Image" UniqueName="IMAGE">
                        <ItemTemplate>
                            <telerik:RadBinaryImage ID="radbinaryimg" runat="server" Height="80px" ImageUrl='<%# "~/Photos/" + Eval("IMG_Name") %>' />
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
              </Columns>
                <EditFormSettings UserControlName="~/MyUserControl.ascx" EditFormType="WebUserControl">
                    <EditColumn UniqueName="EditColumn1" ButtonType="ImageButton"></EditColumn>
                </EditFormSettings>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>
***********************************************************
My problem is that i want insert and update values.So Please help me.
please help me what i want to write in MyUserControl.ascx.csfile and in ASPX.CS file.
Please.
please.
please.

0
Nidhi
Top achievements
Rank 1
answered on 04 Oct 2013, 10:43 AM
using Telerik cascading dropdownlist, when i want to edit record by click on telerik grid the data is showing in first dropdownlist which is country and second state dropdownlist is not showing its value ,when oncahnge event occur in state dropdown then state dropdown get selected correct pls help me....
0
Shinu
Top achievements
Rank 1
answered on 04 Oct 2013, 12:48 PM
Hi Nidhi ,

Please have a look at the following demo which shows the Cascading Combobox in edit mode.
Grid - Accessing Cells and Rows

Thanks,
Shinu
Tags
Grid
Asked by
Reda
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Reda
Top achievements
Rank 1
Dio
Top achievements
Rank 1
Yavor
Telerik team
Princy
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Rajitha Reshmai
Top achievements
Rank 1
Pavlina
Telerik team
Jaime Bula
Top achievements
Rank 2
Balakrishna Reddy
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Nidhi
Top achievements
Rank 1
Share this question
or