Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating Repeater Template at runtime and based upon user input
    text
    copied!<p>Is it possible to dynamically create an ItemTemplate for a repeater somehow?</p> <p>I am trying to use a repeater since it allows the most control, but one of my requirements is making me reconsider.</p> <p>I basically have a number of SQL queries that I do through a web service. Rather than having users type in the entire query I want them to be able to select "parts", "products", or "packages" via radio buttons, enter a search term in a text box, and some other info, and the page returns the results they want. I have this mostly done, the RadioButtons control logic, and I have the query set up to accept the input from the text box as a search term with wildcards. The only probelm is I am struggling with the repeater control. The problem is each one of the tables has a different number of columns and they have different names, so doing a <code>&lt;td&gt;&lt;%# DataBinder.Eval(Container,\"DataItem.Description\") %&gt;&lt;/td&gt;</code> within the ItemTemplate is not possible(I don't know until bind time which one of the 3(possibly more in the future)templates to use)</p> <p>I tried using a literal to pass in what I wanted based on logic in the codebehind, but I couldn't pass the inline functions, and I have been unable to put together how to do this based on an earlier question.</p> <p>I have been reading the MSDN reference and it seems like if I learn the DataList control it will make things easier, but I'd rather not waste time on that if there's an easy way to do it with a repeater(which will also allow me more control)</p> <p>Thank you</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload