RadDropDown OnItemSelected/OnClientItemSelected

2 posts, 0 answers
  1. Mike
    Mike avatar
    3 posts
    Member since:
    Apr 2013

    Posted 26 Sep Link to this post

    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

  2. Mike
    Mike avatar
    3 posts
    Member since:
    Apr 2013

    Posted 26 Sep Link to this post

    Derp ... did not realize the XML was in there twice. My mistake!
Back to Top