Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > dropdownlist problem

Reply
Thread Tools

dropdownlist problem

 
 
JohnE
Guest
Posts: n/a
 
      05-31-2010
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.PageRequestManagerServerErrorExceptio n: 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("ddlIsChildOfIDIn sertEdit");

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

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
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-31-2010
On May 31, 6:32*am, JohnE <(E-Mail Removed)> 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.PageRequestManagerServerErrorExceptio n: 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("ddlIsChildOfIDIn sertEdit");
>
> * * * * if (ddlIsChildOfIDInsertEdit != null)
> * * * * {
> * * * * * * e.Values["IsChildOf"] =
> (Convert.ToInt32(ddlIsChildOfIDInsertEdit.Selected Value));
> * * * * }
> * * }
>
> 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/.../27/89475.aspx
 
Reply With Quote
 
 
 
 
JohnE
Guest
Posts: n/a
 
      05-31-2010


"Alexey Smirnov" wrote:

> On May 31, 6:32 am, JohnE <(E-Mail Removed)> 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.PageRequestManagerServerErrorExceptio n: 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("ddlIsChildOfIDIn sertEdit");
> >
> > if (ddlIsChildOfIDInsertEdit != null)
> > {
> > e.Values["IsChildOf"] =
> > (Convert.ToInt32(ddlIsChildOfIDInsertEdit.Selected Value));
> > }
> > }
> >
> > 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/.../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
 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-31-2010
On May 31, 5:12*pm, JohnE <(E-Mail Removed)> wrote:
> "Alexey Smirnov" wrote:
> > On May 31, 6:32 am, JohnE <(E-Mail Removed)> 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.PageRequestManagerServerErrorExceptio n: 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("ddlIsChildOfIDIn sertEdit");

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

>
> > > 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/.../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
 
Reply With Quote
 
JohnE
Guest
Posts: n/a
 
      05-31-2010


"Alexey Smirnov" wrote:

> On May 31, 5:12 pm, JohnE <(E-Mail Removed)> wrote:
> > "Alexey Smirnov" wrote:
> > > On May 31, 6:32 am, JohnE <(E-Mail Removed)> 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.PageRequestManagerServerErrorExceptio n: 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("ddlIsChildOfIDIn sertEdit");

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

> >
> > > > 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/.../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?

 
Reply With Quote
 
JohnE
Guest
Posts: n/a
 
      06-01-2010


"Alexey Smirnov" wrote:

> On May 31, 5:12 pm, JohnE <(E-Mail Removed)> wrote:
> > "Alexey Smirnov" wrote:
> > > On May 31, 6:32 am, JohnE <(E-Mail Removed)> 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.PageRequestManagerServerErrorExceptio n: 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("ddlIsChildOfIDIn sertEdit");

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

> >
> > > > 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/.../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;

<asparameter 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?

 
Reply With Quote
 
JohnE
Guest
Posts: n/a
 
      06-01-2010


"Alexey Smirnov" wrote:

> On May 31, 5:12 pm, JohnE <(E-Mail Removed)> wrote:
> > "Alexey Smirnov" wrote:
> > > On May 31, 6:32 am, JohnE <(E-Mail Removed)> 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.PageRequestManagerServerErrorExceptio n: 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("ddlIsChildOfIDIn sertEdit");

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

> >
> > > > 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/.../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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownList inside GridView: How to set SelectedIndex for the DropDownList? keithb ASP .Net 1 11-01-2006 05:24 AM
GridView: Filter DropDownList for another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-29-2005 07:44 AM
GridView: Filtr DropDownList from another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-23-2005 01:31 PM
databinding a Dropdownlist to another dropdownlist tshad ASP .Net 8 10-19-2005 10:00 PM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM



Advertisments