Parsing HTML Input to C# code on Page Load

141 Views Asked by At

I have a tricky question. Hope somebody can answer this for me.

I am using a Site based on DOtnetNuke CMS. I have a page which has an input field

<input name="ct100$dynamicinputfield1" id=ct100$dynamicinputfield1 value="abc">

This input field is auto generated and i cannot change the code for this.

Now i have another module which runs on Page_load

The module has A stored Procedure which expects an input parameter which is the value of the Input field mentioned above.

I supply the parameter to the code using this line

string Id = Request.Form["ctl00$dynamicinputfield1"];

I get the following Error

Error:System.Data.SqlClient.SqlException (0x80131904): Procedure or function 'GetAddressByID' expects parameter '@ID', which was not supplied.

I believe this happens because the Server side code executes before the client side. and thus the Request.form cannot find the dynamicinputfield1. How can i solve this Issue.

1

There are 1 best solutions below

0
On

After posting the form from client side you must have to get this property value. Before posting the form how can u get one. second thing you must get the value of the item on server side before posting to client with the original name of the input field.

hope this answer helps.