- 爱易网页
-
ASP.NET教程
- RadioButton向数据库中插入图片地址-=======简单,请指点
日期:2014-05-19 浏览次数:20474 次
RadioButton向数据库中插入图片地址--=======简单,请高手指点指点
<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字段下。
}
------解决方案--------------------
.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 "