Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > FormView ObjectDataSource FormParameter can't find textbox if inside asp:table

Reply
Thread Tools

FormView ObjectDataSource FormParameter can't find textbox if inside asp:table

 
 
hooterbite@yahoo.com
Guest
Posts: n/a
 
      04-26-2006
I am using an object datasource to call a stored procedure to update an
SQL table.
THE STORED PROCEDURE WORKS FINE!
THE OBJECTDATASOURCE WORKS FINE!
When the textbox is inside a standard HTML tag <table>, it passes the
value of the textbox to the stored procedure, as expected.
When the textbox is inside an <asp:table> tag, the default value
assigned in the FormParameter tag is passed to the stored procedure, as
if it can't find the textbox.
See code below.
Thanks!

<UpdateParameters>
<asp:FormParameter formfield="subdetail_date" name="subdetail_date"
defaultvalue="1/1/01" />
</UpdateParameters>

<table><tr><td>
<asp:TextBox Text='<%# Bind("subdetail_date") %>' runat="server"
ID="subdetail_date" size="64" />
</td></tr></table>

<asp:table runat="server"><asp:tablerow><asp:tablecell>
<asp:TextBox Text='<%# Bind("subdetail_date") %>' runat="server"
ID="subdetail_date" size="64" />
</asp:tablecell></asp:tablerow></asp:table>

 
Reply With Quote
 
 
 
 
twostepted
Guest
Posts: n/a
 
      04-30-2006
I'm having the same type of problem. It seems as if when the control
referenced by the FormParameter is within another control, the
FormParameter can't correctly bind to the control. That really sucks!


Here are my params / form controls which aren't being picked up. The
reason that the tablerows are runat=Server is that they're being
selectively hidden in some postback code. I'm going to try and remove
the runat=server and do the hiding on the client to see if the update
problems dissappear. I'll write back if it works.

<tr id="trAccountInsert" runat="server">
<td class="clsLabel">Account:</td>
<td><aspropDownList ID="ddlAccountInsert" runat="server"
DataSourceID="DSAccounts"
SelectedValue = '<%# Bind("ACCOUNT_ID") %>'
DataValueField="ACCOUNT_ID"
DataTextField="ACCOUNT_NAME"
AppendDataBoundItems="true">
<asp:ListItem Value="" Text=" < none > " />
</aspropDownList></td></tr>
<tr id="trPartnerInsert" runat="server">
<td class="clsLabel">Partner:</td>
<td><aspropDownList ID="ddlPartnerInsert" runat="server"
DataSourceID="DSPartners"
SelectedValue = '<%# Bind("PARTNER_ID") %>'
DataValueField="PARTNER_ID"
DataTextField="PARTNER_NAME"
AppendDataBoundItems="true">
<asp:ListItem Value="" Text=" < none > " />
</aspropDownList></td></tr>
<tr>

<UpdateParameters>
...
<asp:FormParameter Name="ACCOUNT_ID" Type="Int32"
FormField="ddlAccountEdit" ConvertEmptyStringToNull="true" />
<asp:FormParameter Name="PARTNER_ID" Type="int32"
FormField="ddlPartnerEdit" ConvertEmptyStringToNull="true" />
</UpdateParameters>

 
Reply With Quote
 
 
 
 
twostepted
Guest
Posts: n/a
 
      04-30-2006
Sorry, when I said:
It seems as if when the control referenced by the FormParameter is
within another control, the FormParameter can't correctly bind to the
control.

I really meant:
It seems as if when the control referenced by the FormParameter is
within another control WITH RUNAT=SERVER, the FormParameter can't
correctly bind to the control.

I may be wrong and ASP.NET might just be renaming the control,
prepending the outer control with runat=server's name. If so, I would
have to change the name I used in the FormParameter, FieldName.

My solution was to keep the name the same and remove the runat=server.
It was better to show/hide the controls on the client anyway to avoid a
postback.

Yeah!

 
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
RowCommand: accessing ObjectDataSource from inside gridview inside a repeater? HockeyFan ASP .Net 1 07-04-2007 05:49 AM
checkboxlist inside a formview databind with objectdatasource(Please somebody help me) Jai ASP .Net 0 09-25-2006 01:18 PM
checkboxlist inside a formview databind with objectdatasource Jai ASP .Net 0 09-24-2006 04:09 PM
find a TextBox in a FormView in javascript Liones ASP .Net 2 09-04-2006 10:35 PM
access controls inside formview inside loginview wikkiwikkiwaa ASP .Net 2 08-09-2006 06:27 AM



Advertisments