Hi all,
I am trying to create a table of user created filters for a data set and then display the filters in an ASP:Table. Displaying the filters works fine, and I have no problem there. The issue I am having is that the buttons I am trying to add are not adding in the way I think they should.

I am setting the ID, Text, and OnClick events in my code behind in C#, but when I debug and view the source, the values have all been changed, and I can't understand why.

The buttons need to be added, being called "buttonX" where X is the row number the button is in, so I can distinguish later to remove filters if the user clicks on them.

If you think any other code would be helpful to figuring this out, I'd be happy to supply.

Please let me know if you have any ideas, the code behind is here:

{
       Button b = new Button();
       b.OnClientClick = "delete_Item";
       b.ID = "delete" + count;
       b.Text = "Remove";
       b.Click +=new EventHandler(delete_Item);

       TableCell temp = new TableCell();
       temp.Controls.Add(b);

       r.Cells.Add(temp);

       filters.Rows.Add(r);

       count++;
}

And the html output is:

<table id="ctl00_SiteContent_ContentPlaceHolder_filters" border="0">
	<tr>
		<td>Age Range</td><td>25 - 36</td><td><input type="submit" name="ctl00$SiteContent_ContentPlaceHolder$delete0" value="Remove" onclick="delete_Item;" id="ctl00_SiteContent_ContentPlaceHolder_delete0" /></td>
	</tr>
</table>
        
        <br />
        
         <div id="action">
            <input type="submit" name="ctl00$SiteContent_ContentPlaceHolder$Create_Button" value="Create Report" id="ctl00_SiteContent_ContentPlaceHolder_Create_Button" />
         </div>

forgot to mention, r is a DataRow, and filters is the ASP Table.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.