views:

22

answers:

1

I have a DropDownList on a page

<select name="Pages1$RadPanelBar1$i0$i0$ddlParentPage" id="Pages1_RadPanelBar1_i0_i0_ddlParentPage" tabindex="2">
    <option value="0">[main menu]</option>
    <option value="1">Home</option>
    <option value="3">Getting Connected</option>
    <option value="5">Communications</option>
    <option value="35">Sitemap</option>
    <option value="46">SlideShow</option>
 </select>

The problem I am having is that the following code is setting ParentID to 0 (which to me, obviously shouldn't be happening)

    'get parent page
    Dim ParentID As Integer = Nothing
    Dim DDLValue As Integer = Integer.Parse(ddlParentPage.SelectedItem.Value)
    If DDLValue > 0 Then
        ParentID = ddlParentPage.SelectedItem.Value
    End If

Thanks in advance for the help.

A: 

So I answered this problem using SQL instead of Code.

I completely removed the IF statement in the code and just submitted the ddl.selecteditem.value into the database Stored Procedure.

From there I did a SQL IF Statement

    IF @ParentID = 0
Begin
    Insert Into icms_Pages
        (
            ParentID,

        )
    Values
        (
            Null,

        )
END
ELSE
    Insert Into icms_Pages
        (
            ParentID,

        )
    Values
        (
            @ParentID,
rockinthesixstring