Hi G2,
You can put a Label server control in the template column:
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label1" runat="server">Label</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
Then, in the code behind:
private void DataGrid1_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item ||e.Item.ItemType==
ListItemType.AlternatingItem)
{
Label label=new Label();
label=(Label)e.Item .FindControl ("Label1");
label.Text ="<INPUT type='radio' name=choice value="+e.Item.ItemIndex+">";
}
}
Last, detect which radio has been checked:
private void Button1_Click(object sender, System.EventArgs e)
{
string selecteditem = Request.Form["choice"];
Response.Write (selecteditem);
}
Does this answer your question? Please let me know if you need more
information
Best Regards,
Lewis
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "g2" <
[email protected]>
| Subject: Datagrid / emit input tag
| Date: Sun, 3 Aug 2003 10:05:35 -0400
| Lines: 6
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: dhcp-0-a0-cc-e1-8-3a.cpe.townisp.com 216.195.29.171
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:5975
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| I have datagrid and a template column present in a column. In the datagrid
| itemdatabound event, I would like to emit a INPUT tag. Any ideas on what
the
| code behind would be like in this event to emit the INPUT tag?
| Thanks.
|
|
|