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

RadDropDown OnItemSelected/OnClientItemSelected

1 Answer 157 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 26 Sep 2017, 04:13 PM

Hi everybody! First and foremost, I am very new to software development, so I have a lot to learn. I've inherited a few projects that need some changes/updates, and the original developer is no longer here nor is there any documentation.

My first small fix is to update a checkbox to a dropdown with 3 values. The RadDropDownList updates one other dropdown on the page (as did the checkbox it's replacing), and the initial RDDL selection is handled on ItemDataBound (I have that part working!). I can't get the RDDL to update the other dropdown, and I'm fairly certain it's because I'm not using it entirely correctly. I've been through the documentation, but there's still so much that I don't know that it's proving difficult. The SelectWOStatus sub below was copypasta'd directly from the ItemCommand/CommandName case that handled the checkbox. Can anyone at least point me in the right direction?

TL;DR:

  • I'm a baby dev; be gentle
  • Replace checkbox with RadDropDownList
  • How do I get the value from the selection and update another dropdown accordingly?
  • Copypasta'd method from ItemCommand/CommandName of previous checkbox
<telerik:GridTemplateColumn HeaderText="Completed (DD)" ItemStyle-HorizontalAlign="Center">
    <ItemTemplate>
        <telerik:RadDropDownList runat="server" ID="ddlStatusWO" OnItemSelected="SelectWOStatus" AutoPostBack="true">
            <Items>
                <telerik:DropDownListItem runat="server" Text="Open" Value="O" />
                <telerik:DropDownListItem runat="server" Text="Completed" Value="F" />
                <telerik:DropDownListItem runat="server" Text="Return Pending" Value="H" />
            </Items>
        </telerik:RadDropDownList>
    </ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Completed (DD)" ItemStyle-HorizontalAlign="Center">
    <ItemTemplate>
        <telerik:RadDropDownList runat="server" ID="ddlStatusWO" OnItemSelected="SelectWOStatus" AutoPostBack="true">
            <Items>
                <telerik:DropDownListItem runat="server" Text="Open" Value="O" />
                <telerik:DropDownListItem runat="server" Text="Completed" Value="F" />
                <telerik:DropDownListItem runat="server" Text="Return Pending" Value="H" />
            </Items>
        </telerik:RadDropDownList>
    </ItemTemplate>
</telerik:GridTemplateColumn>
Protected Sub SelectWOStatus(sender As Object, e As DropDownListEventArgs)
    Dim myJob As BidJob = CType(Session("Job" & hfPageGUID.Value), BidJob)
    Dim intWONum As Integer = myJob.NumberOfWorkOrders()
    Dim intCompletedCount As Integer = 0
    For Each item As GridDataItem In rgWoList.Items
        Dim ddlStatusWOSelectedValue As String = CType(item.FindControl("ddlStatusWO"), RadDropDownList).SelectedValue
        'Dim ddlStatusWOSelectedValue As String = e.Value
        If ddlStatusWOSelectedValue = "F" Or ddlStatusWOSelectedValue = "H" Then
            If intWONum = 1 Then
                ddlBidStatus.SelectedValue = "COMPLETED"
            Else
                ddlBidStatus.SelectedValue = "PARTIALLY COMPLETE"
            End If
        End If
    Next
    If intCompletedCount = 0 Then
        ddlBidStatus.SelectedValue = "AWARDED"
    End If
    If intCompletedCount = intWONum Then
        ddlBidStatus.SelectedValue = "COMPLETED"
    End If
End Sub

asdf

1 Answer, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 26 Sep 2017, 04:15 PM
Derp ... did not realize the XML was in there twice. My mistake!
Tags
DropDownList
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Share this question
or