dropdownlist problem

Discussion in 'ASP .Net' started by JohnE, May 31, 2010.

  1. JohnE

    JohnE Guest

    Hello. I have a "unique" situation (thanks to the prior owner of the
    project) in a webpage. I have dropdownlist inside an InsertItemTemplate of a
    Listview (which is inside a formview's EditItemTemplate). A quick change is
    needed which I am hitting a roadblock. I get the following error

    Sys.WebForms.PageRequestManagerServerErrorException: Could not find control
    'ddlIsChildOfIDInsertEdit' in ControlParameter 'ChangeRequestID'.

    Now, before you go 'HUH' and shake your head and roll your eyes, remember,
    this was a take over project. It will be changed in time, but not just now.
    The Insert is actually an update to only one field. In the sqldatasource it
    actually has InsertCommand with and Update in it. The InsertParameter has
    the following;

    <asp:ControlParameter ControlID="ddlIsChildOfIDInsertEdit"
    Name="ChangeRequestID" PropertyName="SelectedValue" Type="Int32" />

    If I change the ControlID back to ddlSelectChangeRequest it works like it
    should but the information comes from there and not the
    ddlIsChildOfIDInsertEdit, which it needs to do now.

    I tried putting in some code behind for an item inserting (below) but
    doesn't seem it is even needed.

    protected void lvwEditChildren_ItemInserting(object sender,
    ListViewInsertEventArgs e)
    {
    DropDownList ddlIsChildOfIDInsertEdit =
    (DropDownList)e.Item.FindControl("ddlIsChildOfIDInsertEdit");

    if (ddlIsChildOfIDInsertEdit != null)
    {
    e.Values["IsChildOf"] =
    (Convert.ToInt32(ddlIsChildOfIDInsertEdit.SelectedValue));
    }
    }

    Here is the InsertCommand's update statement, which is what is need for the
    update to occur (tried it in sql management studio);

    InsertCommand="UPDATE tblChangeRequest
    SET IsChildOf = ChangeRequestID
    WHERE ChangeRequestID = @ChangeRequestID"


    Has someone come across this error before and if so what was the fix? Is
    there something missing in the above information?

    Any help is appreciated.

    Thanks....John
    JohnE, May 31, 2010
    #1
    1. Advertising

  2. On May 31, 6:32 am, JohnE <> wrote:
    > Hello.  I have a "unique" situation (thanks to the prior owner of the
    > project) in a webpage.  I have dropdownlist inside an InsertItemTemplate of a
    > Listview (which is inside a formview's EditItemTemplate).  A quick change is
    > needed which I am hitting a roadblock.  I get the following error
    >
    > Sys.WebForms.PageRequestManagerServerErrorException: Could not find control
    > 'ddlIsChildOfIDInsertEdit' in ControlParameter 'ChangeRequestID'.
    >
    > Now, before you go 'HUH' and shake your head and roll your eyes, remember,
    > this was a take over project.  It will be changed in time, but not just now.  
    > The Insert is actually an update to only one field.  In the sqldatasource it
    > actually has InsertCommand with and Update in it.  The InsertParameter has
    > the following;
    >
    > <asp:ControlParameter ControlID="ddlIsChildOfIDInsertEdit"
    > Name="ChangeRequestID" PropertyName="SelectedValue" Type="Int32" />
    >
    > If I change the ControlID back to ddlSelectChangeRequest it works like it
    > should but the information comes from there and not the
    > ddlIsChildOfIDInsertEdit, which it needs to do now.  
    >
    > I tried putting in some code behind for an item inserting (below) but
    > doesn't seem it is even needed.  
    >
    >     protected void lvwEditChildren_ItemInserting(object sender,
    > ListViewInsertEventArgs e)
    >     {
    >         DropDownList ddlIsChildOfIDInsertEdit =
    > (DropDownList)e.Item.FindControl("ddlIsChildOfIDInsertEdit");
    >
    >         if (ddlIsChildOfIDInsertEdit != null)
    >         {
    >             e.Values["IsChildOf"] =
    > (Convert.ToInt32(ddlIsChildOfIDInsertEdit.SelectedValue));
    >         }
    >     }
    >
    > Here is the InsertCommand's  update statement, which is what is need for the
    > update to occur (tried it in sql management studio);
    >
    >         InsertCommand="UPDATE tblChangeRequest
    >                         SET IsChildOf = ChangeRequestID
    >                         WHERE ChangeRequestID = @ChangeRequestID"
    >
    > Has someone come across this error before and if so what was the fix?  Is
    > there something missing in the above information?
    >
    > Any help is appreciated.
    >
    > Thanks....John


    Hi John

    Please check if this could help you
    http://geekswithblogs.net/azamsharp/archive/2006/08/27/89475.aspx
    Alexey Smirnov, May 31, 2010
    #2
    1. Advertising

  3. JohnE

    JohnE Guest

    "Alexey Smirnov" wrote:

    > On May 31, 6:32 am, JohnE <> wrote:
    > > Hello. I have a "unique" situation (thanks to the prior owner of the
    > > project) in a webpage. I have dropdownlist inside an InsertItemTemplate of a
    > > Listview (which is inside a formview's EditItemTemplate). A quick change is
    > > needed which I am hitting a roadblock. I get the following error
    > >
    > > Sys.WebForms.PageRequestManagerServerErrorException: Could not find control
    > > 'ddlIsChildOfIDInsertEdit' in ControlParameter 'ChangeRequestID'.
    > >
    > > Now, before you go 'HUH' and shake your head and roll your eyes, remember,
    > > this was a take over project. It will be changed in time, but not just now.
    > > The Insert is actually an update to only one field. In the sqldatasource it
    > > actually has InsertCommand with and Update in it. The InsertParameter has
    > > the following;
    > >
    > > <asp:ControlParameter ControlID="ddlIsChildOfIDInsertEdit"
    > > Name="ChangeRequestID" PropertyName="SelectedValue" Type="Int32" />
    > >
    > > If I change the ControlID back to ddlSelectChangeRequest it works like it
    > > should but the information comes from there and not the
    > > ddlIsChildOfIDInsertEdit, which it needs to do now.
    > >
    > > I tried putting in some code behind for an item inserting (below) but
    > > doesn't seem it is even needed.
    > >
    > > protected void lvwEditChildren_ItemInserting(object sender,
    > > ListViewInsertEventArgs e)
    > > {
    > > DropDownList ddlIsChildOfIDInsertEdit =
    > > (DropDownList)e.Item.FindControl("ddlIsChildOfIDInsertEdit");
    > >
    > > if (ddlIsChildOfIDInsertEdit != null)
    > > {
    > > e.Values["IsChildOf"] =
    > > (Convert.ToInt32(ddlIsChildOfIDInsertEdit.SelectedValue));
    > > }
    > > }
    > >
    > > Here is the InsertCommand's update statement, which is what is need for the
    > > update to occur (tried it in sql management studio);
    > >
    > > InsertCommand="UPDATE tblChangeRequest
    > > SET IsChildOf = ChangeRequestID
    > > WHERE ChangeRequestID = @ChangeRequestID"
    > >
    > > Has someone come across this error before and if so what was the fix? Is
    > > there something missing in the above information?
    > >
    > > Any help is appreciated.
    > >
    > > Thanks....John

    >
    > Hi John
    >
    > Please check if this could help you
    > http://geekswithblogs.net/azamsharp/archive/2006/08/27/89475.aspx
    > .
    >


    Thanks for the reply. Unfortunately, the view source was not complete and
    did not show what was in the formview. I opened up another page to view
    source and got what was being done so I tried it for the ddl to be seen.
    Didn't work. Still getting the same error. Maybe its time to convert it to
    an actual update command, etc. Time to start googling again unless you have
    other thoughts.
    Thanks.
    John
    JohnE, May 31, 2010
    #3
  4. On May 31, 5:12 pm, JohnE <> wrote:
    > "Alexey Smirnov" wrote:
    > > On May 31, 6:32 am, JohnE <> wrote:
    > > > Hello.  I have a "unique" situation (thanks to the prior owner of the
    > > > project) in a webpage.  I have dropdownlist inside an InsertItemTemplate of a
    > > > Listview (which is inside a formview's EditItemTemplate).  A quick change is
    > > > needed which I am hitting a roadblock.  I get the following error

    >
    > > > Sys.WebForms.PageRequestManagerServerErrorException: Could not find control
    > > > 'ddlIsChildOfIDInsertEdit' in ControlParameter 'ChangeRequestID'.

    >
    > > > Now, before you go 'HUH' and shake your head and roll your eyes, remember,
    > > > this was a take over project.  It will be changed in time, but not just now.  
    > > > The Insert is actually an update to only one field.  In the sqldatasource it
    > > > actually has InsertCommand with and Update in it.  The InsertParameter has
    > > > the following;

    >
    > > > <asp:ControlParameter ControlID="ddlIsChildOfIDInsertEdit"
    > > > Name="ChangeRequestID" PropertyName="SelectedValue" Type="Int32" />

    >
    > > > If I change the ControlID back to ddlSelectChangeRequest it works like it
    > > > should but the information comes from there and not the
    > > > ddlIsChildOfIDInsertEdit, which it needs to do now.  

    >
    > > > I tried putting in some code behind for an item inserting (below) but
    > > > doesn't seem it is even needed.  

    >
    > > >     protected void lvwEditChildren_ItemInserting(object sender,
    > > > ListViewInsertEventArgs e)
    > > >     {
    > > >         DropDownList ddlIsChildOfIDInsertEdit =
    > > > (DropDownList)e.Item.FindControl("ddlIsChildOfIDInsertEdit");

    >
    > > >         if (ddlIsChildOfIDInsertEdit != null)
    > > >         {
    > > >             e.Values["IsChildOf"] =
    > > > (Convert.ToInt32(ddlIsChildOfIDInsertEdit.SelectedValue));
    > > >         }
    > > >     }

    >
    > > > Here is the InsertCommand's  update statement, which is what is need for the
    > > > update to occur (tried it in sql management studio);

    >
    > > >         InsertCommand="UPDATE tblChangeRequest
    > > >                         SET IsChildOf = ChangeRequestID
    > > >                         WHERE ChangeRequestID = @ChangeRequestID"

    >
    > > > Has someone come across this error before and if so what was the fix?  Is
    > > > there something missing in the above information?

    >
    > > > Any help is appreciated.

    >
    > > > Thanks....John

    >
    > > Hi John

    >
    > > Please check if this could help you
    > >http://geekswithblogs.net/azamsharp/archive/2006/08/27/89475.aspx
    > > .

    >
    > Thanks for the reply.  Unfortunately, the view source was not complete and
    > did not show what was in the formview.  I opened up another page to view
    > source and got what was being done so I tried it for the ddl to be seen.  
    > Didn't work.  Still getting the same error.  Maybe its time to convert it to
    > an actual update command, etc.  Time to start googling again unless you have
    > other thoughts.
    > Thanks.
    > John


    I think you can try to enable tracing to see where your controls are.

    Use

    <%@ Page Trace="true"...

    or

    How to: Enable Tracing for an ASP.NET Application
    http://msdn.microsoft.com/en-us/library/0x5wc973.aspx
    Alexey Smirnov, May 31, 2010
    #4
  5. JohnE

    JohnE Guest

    "Alexey Smirnov" wrote:

    > On May 31, 5:12 pm, JohnE <> wrote:
    > > "Alexey Smirnov" wrote:
    > > > On May 31, 6:32 am, JohnE <> wrote:
    > > > > Hello. I have a "unique" situation (thanks to the prior owner of the
    > > > > project) in a webpage. I have dropdownlist inside an InsertItemTemplate of a
    > > > > Listview (which is inside a formview's EditItemTemplate). A quick change is
    > > > > needed which I am hitting a roadblock. I get the following error

    > >
    > > > > Sys.WebForms.PageRequestManagerServerErrorException: Could not find control
    > > > > 'ddlIsChildOfIDInsertEdit' in ControlParameter 'ChangeRequestID'.

    > >
    > > > > Now, before you go 'HUH' and shake your head and roll your eyes, remember,
    > > > > this was a take over project. It will be changed in time, but not just now.
    > > > > The Insert is actually an update to only one field. In the sqldatasource it
    > > > > actually has InsertCommand with and Update in it. The InsertParameter has
    > > > > the following;

    > >
    > > > > <asp:ControlParameter ControlID="ddlIsChildOfIDInsertEdit"
    > > > > Name="ChangeRequestID" PropertyName="SelectedValue" Type="Int32" />

    > >
    > > > > If I change the ControlID back to ddlSelectChangeRequest it works like it
    > > > > should but the information comes from there and not the
    > > > > ddlIsChildOfIDInsertEdit, which it needs to do now.

    > >
    > > > > I tried putting in some code behind for an item inserting (below) but
    > > > > doesn't seem it is even needed.

    > >
    > > > > protected void lvwEditChildren_ItemInserting(object sender,
    > > > > ListViewInsertEventArgs e)
    > > > > {
    > > > > DropDownList ddlIsChildOfIDInsertEdit =
    > > > > (DropDownList)e.Item.FindControl("ddlIsChildOfIDInsertEdit");

    > >
    > > > > if (ddlIsChildOfIDInsertEdit != null)
    > > > > {
    > > > > e.Values["IsChildOf"] =
    > > > > (Convert.ToInt32(ddlIsChildOfIDInsertEdit.SelectedValue));
    > > > > }
    > > > > }

    > >
    > > > > Here is the InsertCommand's update statement, which is what is need for the
    > > > > update to occur (tried it in sql management studio);

    > >
    > > > > InsertCommand="UPDATE tblChangeRequest
    > > > > SET IsChildOf = ChangeRequestID
    > > > > WHERE ChangeRequestID = @ChangeRequestID"

    > >
    > > > > Has someone come across this error before and if so what was the fix? Is
    > > > > there something missing in the above information?

    > >
    > > > > Any help is appreciated.

    > >
    > > > > Thanks....John

    > >
    > > > Hi John

    > >
    > > > Please check if this could help you
    > > >http://geekswithblogs.net/azamsharp/archive/2006/08/27/89475.aspx
    > > > .

    > >
    > > Thanks for the reply. Unfortunately, the view source was not complete and
    > > did not show what was in the formview. I opened up another page to view
    > > source and got what was being done so I tried it for the ddl to be seen.
    > > Didn't work. Still getting the same error. Maybe its time to convert it to
    > > an actual update command, etc. Time to start googling again unless you have
    > > other thoughts.
    > > Thanks.
    > > John

    >
    > I think you can try to enable tracing to see where your controls are.
    >
    > Use
    >
    > <%@ Page Trace="true"...
    >
    > or
    >
    > How to: Enable Tracing for an ASP.NET Application
    > http://msdn.microsoft.com/en-us/library/0x5wc973.aspx
    > .
    >


    Tried the trace and it doesn't show there either. It seems to skip over
    most all of the formview controls. Which is what the ddl is in. It is on
    the page, connected to sqldatasource to populate it. Ya know what the irony
    of all this is; this is the last thing I need to do on this page. Until
    this, most all was going relatively well.

    Your opinion/thoughts on using code behind for the update of the field and
    not use the sqldatasource inserttemplate?
    JohnE, May 31, 2010
    #5
  6. JohnE

    JohnE Guest

    "Alexey Smirnov" wrote:

    > On May 31, 5:12 pm, JohnE <> wrote:
    > > "Alexey Smirnov" wrote:
    > > > On May 31, 6:32 am, JohnE <> wrote:
    > > > > Hello. I have a "unique" situation (thanks to the prior owner of the
    > > > > project) in a webpage. I have dropdownlist inside an InsertItemTemplate of a
    > > > > Listview (which is inside a formview's EditItemTemplate). A quick change is
    > > > > needed which I am hitting a roadblock. I get the following error

    > >
    > > > > Sys.WebForms.PageRequestManagerServerErrorException: Could not find control
    > > > > 'ddlIsChildOfIDInsertEdit' in ControlParameter 'ChangeRequestID'.

    > >
    > > > > Now, before you go 'HUH' and shake your head and roll your eyes, remember,
    > > > > this was a take over project. It will be changed in time, but not just now.
    > > > > The Insert is actually an update to only one field. In the sqldatasource it
    > > > > actually has InsertCommand with and Update in it. The InsertParameter has
    > > > > the following;

    > >
    > > > > <asp:ControlParameter ControlID="ddlIsChildOfIDInsertEdit"
    > > > > Name="ChangeRequestID" PropertyName="SelectedValue" Type="Int32" />

    > >
    > > > > If I change the ControlID back to ddlSelectChangeRequest it works like it
    > > > > should but the information comes from there and not the
    > > > > ddlIsChildOfIDInsertEdit, which it needs to do now.

    > >
    > > > > I tried putting in some code behind for an item inserting (below) but
    > > > > doesn't seem it is even needed.

    > >
    > > > > protected void lvwEditChildren_ItemInserting(object sender,
    > > > > ListViewInsertEventArgs e)
    > > > > {
    > > > > DropDownList ddlIsChildOfIDInsertEdit =
    > > > > (DropDownList)e.Item.FindControl("ddlIsChildOfIDInsertEdit");

    > >
    > > > > if (ddlIsChildOfIDInsertEdit != null)
    > > > > {
    > > > > e.Values["IsChildOf"] =
    > > > > (Convert.ToInt32(ddlIsChildOfIDInsertEdit.SelectedValue));
    > > > > }
    > > > > }

    > >
    > > > > Here is the InsertCommand's update statement, which is what is need for the
    > > > > update to occur (tried it in sql management studio);

    > >
    > > > > InsertCommand="UPDATE tblChangeRequest
    > > > > SET IsChildOf = ChangeRequestID
    > > > > WHERE ChangeRequestID = @ChangeRequestID"

    > >
    > > > > Has someone come across this error before and if so what was the fix? Is
    > > > > there something missing in the above information?

    > >
    > > > > Any help is appreciated.

    > >
    > > > > Thanks....John

    > >
    > > > Hi John

    > >
    > > > Please check if this could help you
    > > >http://geekswithblogs.net/azamsharp/archive/2006/08/27/89475.aspx
    > > > .

    > >
    > > Thanks for the reply. Unfortunately, the view source was not complete and
    > > did not show what was in the formview. I opened up another page to view
    > > source and got what was being done so I tried it for the ddl to be seen.
    > > Didn't work. Still getting the same error. Maybe its time to convert it to
    > > an actual update command, etc. Time to start googling again unless you have
    > > other thoughts.
    > > Thanks.
    > > John

    >
    > I think you can try to enable tracing to see where your controls are.
    >
    > Use
    >
    > <%@ Page Trace="true"...
    >
    > or
    >
    > How to: Enable Tracing for an ASP.NET Application
    > http://msdn.microsoft.com/en-us/library/0x5wc973.aspx
    > .
    >


    Well, okay. I think it might be closer. I took out the control parameter
    line and put in the following;

    <asp:parameter Direction="Input" Name="ChangeRequestID" Type="Int32" />

    No errors occurred, but, nothing was entered into the field either. The
    droplist item was selected, the linkbutton (Insert) was clicked, and the
    droplist returned to the empty line. All the others on the same page have
    the same action. So, at least half there.

    On the code behind in the ItemInserting (original post) hovering over the
    selectedvalue shows the value that is needed.

    Thoughts?
    JohnE, Jun 1, 2010
    #6
  7. JohnE

    JohnE Guest

    "Alexey Smirnov" wrote:

    > On May 31, 5:12 pm, JohnE <> wrote:
    > > "Alexey Smirnov" wrote:
    > > > On May 31, 6:32 am, JohnE <> wrote:
    > > > > Hello. I have a "unique" situation (thanks to the prior owner of the
    > > > > project) in a webpage. I have dropdownlist inside an InsertItemTemplate of a
    > > > > Listview (which is inside a formview's EditItemTemplate). A quick change is
    > > > > needed which I am hitting a roadblock. I get the following error

    > >
    > > > > Sys.WebForms.PageRequestManagerServerErrorException: Could not find control
    > > > > 'ddlIsChildOfIDInsertEdit' in ControlParameter 'ChangeRequestID'.

    > >
    > > > > Now, before you go 'HUH' and shake your head and roll your eyes, remember,
    > > > > this was a take over project. It will be changed in time, but not just now.
    > > > > The Insert is actually an update to only one field. In the sqldatasource it
    > > > > actually has InsertCommand with and Update in it. The InsertParameter has
    > > > > the following;

    > >
    > > > > <asp:ControlParameter ControlID="ddlIsChildOfIDInsertEdit"
    > > > > Name="ChangeRequestID" PropertyName="SelectedValue" Type="Int32" />

    > >
    > > > > If I change the ControlID back to ddlSelectChangeRequest it works like it
    > > > > should but the information comes from there and not the
    > > > > ddlIsChildOfIDInsertEdit, which it needs to do now.

    > >
    > > > > I tried putting in some code behind for an item inserting (below) but
    > > > > doesn't seem it is even needed.

    > >
    > > > > protected void lvwEditChildren_ItemInserting(object sender,
    > > > > ListViewInsertEventArgs e)
    > > > > {
    > > > > DropDownList ddlIsChildOfIDInsertEdit =
    > > > > (DropDownList)e.Item.FindControl("ddlIsChildOfIDInsertEdit");

    > >
    > > > > if (ddlIsChildOfIDInsertEdit != null)
    > > > > {
    > > > > e.Values["IsChildOf"] =
    > > > > (Convert.ToInt32(ddlIsChildOfIDInsertEdit.SelectedValue));
    > > > > }
    > > > > }

    > >
    > > > > Here is the InsertCommand's update statement, which is what is need for the
    > > > > update to occur (tried it in sql management studio);

    > >
    > > > > InsertCommand="UPDATE tblChangeRequest
    > > > > SET IsChildOf = ChangeRequestID
    > > > > WHERE ChangeRequestID = @ChangeRequestID"

    > >
    > > > > Has someone come across this error before and if so what was the fix? Is
    > > > > there something missing in the above information?

    > >
    > > > > Any help is appreciated.

    > >
    > > > > Thanks....John

    > >
    > > > Hi John

    > >
    > > > Please check if this could help you
    > > >http://geekswithblogs.net/azamsharp/archive/2006/08/27/89475.aspx
    > > > .

    > >
    > > Thanks for the reply. Unfortunately, the view source was not complete and
    > > did not show what was in the formview. I opened up another page to view
    > > source and got what was being done so I tried it for the ddl to be seen.
    > > Didn't work. Still getting the same error. Maybe its time to convert it to
    > > an actual update command, etc. Time to start googling again unless you have
    > > other thoughts.
    > > Thanks.
    > > John

    >
    > I think you can try to enable tracing to see where your controls are.
    >
    > Use
    >
    > <%@ Page Trace="true"...
    >
    > or
    >
    > How to: Enable Tracing for an ASP.NET Application
    > http://msdn.microsoft.com/en-us/library/0x5wc973.aspx
    > .
    >


    Just letting you know that I have moved over to using the gridview instead
    of the listview in this situation. So far, so good. And the gridview looks
    no different then what the listview did.
    Thanks for the responses and hangin' in with this issue.
    John
    JohnE, Jun 1, 2010
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mr2_93
    Replies:
    1
    Views:
    3,586
    mr2_93
    Oct 2, 2005
  2. tshad
    Replies:
    8
    Views:
    2,209
    tshad
    Oct 19, 2005
  3. =?Utf-8?B?SnVhbmpv?=

    GridView: Filtr DropDownList from another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,851
    =?Utf-8?B?SnVhbmpv?=
    Dec 23, 2005
  4. =?Utf-8?B?SnVhbmpv?=

    GridView: Filter DropDownList for another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,286
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  5. keithb
    Replies:
    1
    Views:
    11,920
    shauns1
    Nov 1, 2006
Loading...

Share This Page