Repeater control

  • Thread starter Thread starter sourabh
  • Start date Start date
S

sourabh

HI
I Have repeater control which is tied to a template which looks like
<tr
<td width="40%">
<%# DataBinder.Eval(Container, "DataItem.Name") %>
</td>
<td width="15%">
<input type=radio name=<%# "status"+DataBinder.Eval(Container, "DataItem.Id") %> value=<%# "status1"+DataBinder.Eval(Container, "DataItem.Id") %> id=answer>
</td>
<td width="15%">
<input type=radio name=<%# "status"+DataBinder.Eval(Container, "DataItem.Id") %> value=<%# "status2"+DataBinder.Eval(Container, "DataItem.Id") %> id=answer>
</td>
<td width="20%">
<input type=radio name=<%# "status"+DataBinder.Eval(Container, "DataItem.Id") %> value=<%# "status3"+DataBinder.Eval(Container, "DataItem.Id") %> id=answer>
</td>
</tr >


On the .cs code if want to find the Radio button.
I tried doing Repeater1.FindControl("status1") but this doest not work. I can see status1 when do the view source so i am sure this control is created. Even drilling down into the ItemTemplate this is visible within a DataBoundLiteralControl.

Any ideas how to get this control.

Thanks
Sourabh
 
Hi, Sourabh,

On the server you can programatically access *only* controls that have the
attribute "runat" set to the value "server".

The posted values for rest of the HTML elements you can get from the indexer
of the Request property of the Page class.

My advise is to try using RadioButtonList instead.

Greetings
Martin
HI
I Have repeater control which is tied to a template which looks like
<tr
<td width="40%">
<%# DataBinder.Eval(Container, "DataItem.Name") %>
</td>
<td width="15%">
<input type=radio name=<%# "status"+DataBinder.Eval(Container,
"DataItem.Id") %> value=<%# "status1"+DataBinder.Eval(Container,
"DataItem.Id") %> id=answer>
</td>
<td width="15%">
<input type=radio name=<%# "status"+DataBinder.Eval(Container,
"DataItem.Id") %> value=<%# "status2"+DataBinder.Eval(Container,
"DataItem.Id") %> id=answer>
</td>
<td width="20%">
<input type=radio name=<%# "status"+DataBinder.Eval(Container,
"DataItem.Id") %> value=<%# "status3"+DataBinder.Eval(Container,
"DataItem.Id") %> id=answer>
</td>
</tr >


On the .cs code if want to find the Radio button.
I tried doing Repeater1.FindControl("status1") but this doest not work. I
can see status1 when do the view source so i am sure this control is
created. Even drilling down into the ItemTemplate this is visible within a
DataBoundLiteralControl.

Any ideas how to get this control.

Thanks
Sourabh
 
Back
Top