Bmo
Bmo

Reputation: 1212

Sending a html input box variable back to codebhind

I have the following setup.

 <table>
      <tr>
           <td>
                <%getScheduleTable("LineNumber", rate, count);%>
           </td>
      </tr>
 </table>

getScheduleTable(line, rate, count) goes and builds a table inside of this <td>

Line number is a literal, but the rate and count will fluctuate. How can I assign the values of the html input boxes elsewhere on the form to rate and count?

There are probably a couple thousand questions that answer this, but I can't find them probably because I don't know what the <% %> operation is actually called.

Does it need to be wrapped in Javascript first somehow? Should I be using something else? I might be able to use datagrid, but I need to put a calculated value in the right most column. I'd prefer not to, because I'm almost done and I feel like I'm just one small step away here. I could be wrong and will do what's needed though.

Thanks!

EDIT: The html control's value will be changed by another process. I'm building a simulation of my page to test. When the site is live, I have no control over the element so I just need to grab the value of that box. It can't be changed to a server control unless I hacked an invisible server helper textbox maybe that's my answer?

Upvotes: 1

Views: 126

Answers (1)

Adil
Adil

Reputation: 148150

You can make your td and input server accessible by adding runat="server" and assign them an id to access them in code behind.

Html

<input id="countThisLine" runat="server" />
<table>
      <tr>
           <td id="td1" runat="server">

           </td>
      </tr>
 </table>

In code behind

td.InnerHtml = getScheduleTable(countThisLine.Value, txt, count);

Upvotes: 1

Related Questions