dropdownlist problem

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

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
 
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 justnow.  
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 said:
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
 
Alexey Smirnov said:
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

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 youhave
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 said:
Alexey Smirnov said:
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.

Hi John

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?
 
Alexey Smirnov said:
Alexey Smirnov said:
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.

Hi John

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?
 
Alexey Smirnov said:
Alexey Smirnov said:
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.

Hi John

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
 
Back
Top