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

selectedindexchanged after updatecommand

3 Answers 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mydatafactory
Top achievements
Rank 1
Mydatafactory asked on 03 Jul 2008, 03:43 PM
I have a grid in which I have a RadCombobox. If the text of the combobox changes in 'scheduled' a mail must be sent. This works fine. 
            Dim cell1 As TableCell = editItem("ddlStatus")  
            Dim Status As String = (CType(cell1.Controls(0), RadComboBox)).Text  
             
           If Status = "Scheduled" Then  
 ' rest of code
 
As you may notice the mail will also be sent if something else in the grid changes. The mail must only be sent if the combobox changes. It has something to do with SelectedIndexChanged, but this event must be fired when clicking the 'updatebutton'.

How do I arrange this?

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 07 Jul 2008, 11:41 AM
Hello A.,

If you want to send a mail depending on the RadComboBox when the update button is clicked, why don't you try placing your code in the UpdateCommand event handle of RadGrid. Thus the mail will be sent only when update is clicked and RadComboBox value is as desired.

Find more about grid UpdateCommand here.

Let us know if this helps.

All the best,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mydatafactory
Top achievements
Rank 1
answered on 07 Jul 2008, 12:04 PM
Hello Iana,

Thanks for your reply. In the meantime I tried to make a workaround: see my thread of today.

concerning your solution: do you mean that I can put only the update of the combobox in the updatecommand?
0
Iana Tsolova
Telerik team
answered on 07 Jul 2008, 12:44 PM
Hi A.,

I suggest that you place the code for sending your mails in the UpdateCommand:

Protected Sub RadGrid1_UpdateCommand(ByVal source As ObjectByVal e As Telerik.Web.UI.GridCommandEventArgs)  
    Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)  
    Dim ddlStatus As RadComboBox = editedItem("ddlStatusColumnUniqueName").FindControl("ddlStatus")  
              
    If ddlStatus.SelectedItem.Text = "Scheduled" Then 
               'send mail code here  
    End If 
End Sub 

I hope this helps.

Greetings,
Iana
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Mydatafactory
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Mydatafactory
Top achievements
Rank 1
Share this question
or