<td><asp:RadioButton ID="RadioButton1" runat="server" Width="1px" GroupName="1" Height="1px" Text=" " OnCheckedChanged="RadioButton1_CheckedChanged"  /><asp:Image ID="Image1" runat="server" Height="70%" Width="31%" ImageUrl="~/pic/01.jpg" /></td>有五个RadioButton控件,当我选择其中一个时候,把旁边的Image 的 ImageURL插入到 数据库中(字段时src)由于本人新手 会的少只能用最简单的方法,请前辈指点。String strinto = "insert into [message] ([src]) values ('"+strSRC+"')";protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
    {
      这里怎么定义strSRC 才能把Image1的ImageUrl插入到 src字段下。      
     }

解决方案 »

  1.   

    .aspx<table>
    <tr>
    <td width="100">
    <asp:RadioButton ID="RadioButton1" runat="server" Width="1px" GroupName="rbt1" Height="1px" Text=" "
    OnCheckedChanged="RadioButton1_CheckedChanged" AutoPostBack="True" /></td>
    <td width="100"><asp:Image ID="Image1" runat="server" Height="70%" Width="31%" ImageUrl="~/pic/01.jpg" /></td>
    </tr>
    <tr>
    <td>
    <asp:RadioButton id="RadioButton2" runat="server" OnCheckedChanged="RadioButton1_CheckedChanged"
    Text=" " Height="1px" GroupName="rbt1" Width="1px" AutoPostBack="True"></asp:RadioButton></td>
    <td><asp:Image ID="Image2" runat="server" Height="70%" Width="31%" ImageUrl="~/pic/02.jpg" /></td>
    </tr>
    <tr>
    <td>
    <asp:RadioButton id="RadioButton3" runat="server" OnCheckedChanged="RadioButton1_CheckedChanged"
    Text=" " Height="1px" GroupName="rbt1" Width="1px" AutoPostBack="True"></asp:RadioButton></td>
    <td><asp:Image ID="Image3" runat="server" Height="70%" Width="31%" ImageUrl="~/pic/03.jpg" /></td>
    </tr>
    <tr>
    <td>
    <asp:RadioButton id="RadioButton4" runat="server" OnCheckedChanged="RadioButton1_CheckedChanged" Text=" "
    Height="1px" GroupName="rbt1" Width="1px" AutoPostBack="True"></asp:RadioButton></td>
    <td><asp:Image ID="Image4" runat="server" Height="70%" Width="31%" ImageUrl="~/pic/04.jpg" /></td>
    <tr>
    <td>
    <asp:RadioButton id="RadioButton5" runat="server" OnCheckedChanged="RadioButton1_CheckedChanged"
    Text=" " Height="1px" GroupName="rbt1" Width="1px" AutoPostBack="True"></asp:RadioButton></td>
    <td><asp:Image ID="Image5" runat="server" Height="70%" Width="31%" ImageUrl="~/pic/05.jpg" /></td>
    </tr>
    </tr>
    </table>
    =======================
    .cs
    protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
    {
    RadioButton rbtn1 = (RadioButton)sender;
    string strSRC = "";
    switch(rbtn1.ID.ToString())
    {
    case "RadioButton1":
    strSRC = Image1.ImageUrl;
    break;
    case "RadioButton2":
    strSRC = Image2.ImageUrl;
    break;
    case "RadioButton3":
    strSRC = Image3.ImageUrl;
    break;
    case "RadioButton4":
    strSRC = Image4.ImageUrl;
    break;
    case "RadioButton5":
    strSRC = Image5.ImageUrl;
    break;
    }
    string strinto = "insert into [message] ([src]) values ('"+strSRC+"')";
    Response.Write(strinto);
    }