Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to bind input text field to pass as parameter to stored procedure in BLL

Thread Tools

How to bind input text field to pass as parameter to stored procedure in BLL
Posts: n/a
Hello all,

I'm fairly new at this so I may be doing this the wrong way but I've
got a FormView within a multiview that when it is updated in edit
mode, will call on the update method associated with the
objectdatasource that fills the formview.

One of the fields is a textbox that when clicked has to open up a
popup window with a listbox and when that popup closes, it sends the
results as a comma delimited string back to the text box. I've done
this with javascript and had to switch from an asp:textbox to input
textbox as I don't believe the asp textbox control has an onclick
event. The issue is that to use the input textbox I have to use
value='<%# Eval("Mrkts") %>' instead of value='<%# Bind("Mrkts") %>'
because if I try Bind it says "A call to Bind must be assigned to a
property of a control inside a template. As is, using Eval, when it
invokes the update method it does not carry over the newly updated
value within the textbox.

Is there a way to work this into a bind that I'm missing?

I tried to go about it by creating another textbox somewhere within
that formview that i would use to pass to the update method but within
the javascript I need to do getElementById(controlID) but I am unable
to track down how it is building this controlID. I can do this for a
asp textbox outside of the formview but that is no help.

I'm thinking the best approach is to have it go into the code behind
when hitting the update button and call the update method from in
there but I'm not able to see any of the values for any of the fields
within this formview from the codebehind the way I'm doing it. I've
tried FindControl with not much luck.

If anyone can provide some insight I'd be thrilled. Thanks1

Reply With Quote
Posts: n/a
So after spending all day on it, almost immediately after posting this
I figured out how to grab the clientID of the textbox within the
formview. However, I try to update that textbox from the javascript
and nothing happens. It works fine for a textbox that I placed
outside of the multiview though...

self.opener.document.getElementById("ctl00_MainCon tent_TextBox1").setAttribute("value","Foo");
self.opener.document.getElementById("ctl00_MainCon tent_FormViewcSIDDtls_MrktsTextBoxTest").setAttrib ute("value","bar");

When this code runs from either the parent or the child, it only
updates the one outside the multiview which is the first one.

Serenity now....

Reply With Quote
Posts: n/a
Ok I found a workaround. If anyone knows the correct way to do this
or a better way please enlighten me

I figured out how the controlIDs are built so I was able to use
javascript and setAttribute to update an asp control from the child
popup. Rather than a textbox I actually used hiddenfield control so
it wasn't in the way. I used Bind on the hidden field and that did
the trick when calling the update method.

Reply With Quote

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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Variable Input on procedure - pass by value or pass by reference? Tricky VHDL 0 03-19-2009 03:58 PM
Iterating through array as input parameter to stored procedure. asgars ASP .Net 0 06-05-2006 04:08 PM
add one input parameter to stored procedure DC Gringo ASP .Net 0 09-02-2004 04:34 PM
Using query string to pass a value to a stored procedure parameter Machelle Chandler ASP .Net Datagrid Control 0 10-20-2003 11:22 PM