Last post Feb 26, 2009 08:25 AM by jnc
Feb 25, 2009 10:28 AM|Disco Patrick|LINK
I have made a custom control that outputs a bunch of html. I have added a property through the code behind like this:
private string sectionID;
public string SectionID
sectionID = value;
<ccl:MyControl runat="server" SectionID="2" />
<div id="section<%# SectionID; %>" >
Feb 25, 2009 12:37 PM|jnc|LINK
I'm no expert in fact I am waiting for an anwer to one of my questions, but
in your case what I would probably do is create your div at runtime then you will be able to get the value which can be added as the id
Feb 25, 2009 03:14 PM|Disco Patrick|LINK
I appreciate you can create these things at runtime.
However, if it is possible to do in a way that is similar to what I am trying to do, i.e. by injecting the value into the markup, I would like to know about it.
If it is not possible, I would like someone to confirm this so I can move on!
Feb 26, 2009 07:06 AM|jnc|LINK
I understand, this builds on mine, I have not attempted to reference the new id in the div which I presume is what what you want to do
you might try passing the value to a hidden field then getting the value from the field using getelementbyid("hiddenfield").innettext
ID='<%# DataBinder.Eval(Container, "DataItem.AppData") %>'
Feb 26, 2009 07:42 AM|Disco Patrick|LINK
Here's the full story... I tried to create a complex form using the Wizard web control. However I soon discovered that this control outputs its HTML in tables. I wasn't happy with this, so set about creating my own page to reflect the functionality of the
So I created a div for each section of the form, in the same way that the Wizard has a WizardStep for each section. The code inside each of these divs was the same, so I decided to create a user control that I could re-use. Each div contains a number of
questions that are taken from the database. Each question belongs to a specific section, which is why I added the SectionID property to the control, so the control would only fetch the questions related to that section.
"sectionN". And that is why I need to give each div a specific ID!!!
This is what I need to understand:
<%# DataBinder.Eval(Container, "DataItem.AppData") %>'
Feb 26, 2009 08:06 AM|Disco Patrick|LINK
I found this to work:
<%# DataBinder.Eval(Container.DataItem, "columnName") %>
Feb 26, 2009 08:25 AM|jnc|LINK
I did once do a database driven page which collected the data in code behind then built a grid using a <table>, I added IDs to each cell similar to spreadsheet coordinates but all, as I said in code behind