1> All images come on new line i want them next to each other.
Do you mean the user controls? Images by default display inline. You maybe able to change the way the usercontrol displays by setting it's style: style="display:inline"
2> How to detect which radio button is clicked as i have more than one images, and all have radio buttons.
3> How to capture click of radio button from aspx page?
Make sure autopostback is true for the radio buttons.
The event in the UserControl will not show up in the properties window. You have to set it manually.
User Control Markup:
<![CDATA[<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="UserControls_WebUserControl" %>
<asp:button id="Button1" runat="server" text="Button" />
<br />
<asp:radiobutton id="RadioButton1" runat="server" autopostback="True" >
oncheckedchanged="RadioButton1_CheckedChanged" />
User Control Code behind:
public partial class UserControls_WebUserControl : System.Web.UI.UserControl
{
public event EventHandler UC_RadioClicked;
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
if (UC_RadioClicked != null)
UC_RadioClicked(sender, e);
}
Page Markup:
<uc1:webusercontrol id="WebUserControl1" runat="server" onuc_radioclicked="UC_RadioClicked" xmlns:uc1="#unknown" />
Page Code Behind:
protected void UC_RadioClicked(object sender, EventArgs e)
{
RadioButton RB = sender as RadioButton;
Response.Write("Radio button in user control clicked: " + RB.Parent.ID);
}