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

DropDownList Value Not in Hashtable

1 Answer 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ray
Top achievements
Rank 1
Ray asked on 11 Jul 2016, 06:03 PM

I have an application for training attendance where a column in the database is a varchar but when editing the record they want a dropdown with Yes|No values. That is fine however, when updating the the records the UpdateCommand does not the dropdown values in the Hashtable.

BTW - the edimode for the grid is "InPlace".

Any help would greatly be appreciated. Thanks

 

ASPX

<telerik:GridTemplateColumn DataField="Attended" HeaderText="Attended" AllowFiltering="false">
                    <ItemTemplate>
                        <asp:Label ID="AttendedLabel" runat="server" Text='<%# Eval("Attended") %>'></asp:Label>
                    </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDropDownList ID="ddAttended" runat="server" Width="55px">
                        <Items>
                            <telerik:DropDownListItem Text="" />
                            <telerik:DropDownListItem Text="Yes" />
                            <telerik:DropDownListItem Text="No" />
                        </Items>
                    </telerik:RadDropDownList>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>

VB

 

Protected Sub rgCourse_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
        If (e.CommandName = "UpdateAll") Then
            For Each editedItem As GridEditableItem In rgCourse.EditItems
                Dim newValues As Hashtable = New Hashtable
                'The GridTableView will fill the values from all editable columns in the hash
                e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)
                dsCourses.UpdateCommand = String.Format("Update vwCurrentCourse SET Attended='{0}' WHERE Registration_ID='{1}'", newValues("Attended").ToString(), editedItem.GetDataKeyValue("Registration_ID").ToString())
                dsCourses.Update()
 
                editedItem.Edit = Falsetable
            Next
        End If
        rgCourse.Rebind()
    End Sub

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 14 Jul 2016, 01:40 PM
Hello Ray,

I've already replied to your ticket with ID: 1049853. I suggest that we continue our conversation on the mentioned thread if there are any further questions.

Regards,
Eyup
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Ray
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or