Question

Project - ASP.Net 1.1 Website

I am creating dynamic HtmlInput controls and adding class, id and name attribute to it.

Example -

HtmlInput obj = new HtmlInput
obj.Attributes.Add("id", "A1");
obj.Attributes.Add("name", "A1");
obj.Attributes.Add("class", "Format");

Now during postback, i am tryin to read from Request.Form["A1"] but i cant read it, because the name attribute when checked in HTML is automatically renamed as "_Ct1"

Automatically changed by ASP.NET.

Can somebody, please help me retain my name field, so that i can read the value on postback ?

Was it helpful?

Solution

Michael Liu provided a solution, but he responded to my question, so i cant mark it as an answer. But it is the right thing to do, Use obj.ID = "myID" and this will be retained as your control name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top