Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 如何在我的代码中创建自定义换行符_Image_C# 4.0_Radio Button - Fatal编程技术网

Image 如何在我的代码中创建自定义换行符

Image 如何在我的代码中创建自定义换行符,image,c#-4.0,radio-button,Image,C# 4.0,Radio Button,我在C#中有以下代码,它从db打印图像。通过这些代码,图像和单选按钮在单行中显示单个时间。这是我的代码 foreach (DataRow item in ds.Tables[0].Rows) { divs += @" <div style="" position:relative; height:100px; width:400px; margin:10px auto;""> <d

我在C#中有以下代码,它从db打印图像。通过这些代码,图像和单选按钮在单行中显示单个时间。这是我的代码

foreach (DataRow item in ds.Tables[0].Rows)
        {
            divs += @"  <div style="" position:relative; height:100px; width:400px; margin:10px auto;"">
                            <div style=""position:absolute; width:80px; height:80px; top: 10px; left: 130px;"">
                                 <a href=""#"" class=""screenshot"" rel=""images/"+item["namee"].ToString()+@".jpg"" ><img src=""images/" + item["namee"].ToString() + @".jpg"" width=""80px"" height=""80px""  /></a>
                        </div>";
            if(id < 1){
            divs += @"  <div style=""position:absolute; width:231px; left:240px; top:35px; height: 40px;"">
                                <p style="" margin-top:10px; margin-left:20px; ""><input type=""radio"" name=""SSRI"" value=""" + item["namee"].ToString() + @""" /></p>
                            </div>";
            }

            divs += @"<div style=""position:absolute; width:231px; left:100px; bottom:10px; height: 40px;"">

                            </div>
                        </div>";
        }
        Response.Write(divs);
但是我想把它弄出来,b应该这样吗

Images '' radio
Images '' radio
Images '' radio    Images '' radio
Images '' radio    Images '' radio

有人能帮我做这件事吗。请帮忙

我不确定您当前的代码如何尝试执行您想要的操作,但您应该使用。移除所有
顶部
左侧和
位置:绝对
,只需使用
浮动
高度
宽度
。然后使用
清除:左到新行

例如,在代码中:

int currLine = 0;
foreach (DataRow item in ds.Tables[0].Rows)
{
      if (currLine % 2 == 0)
      {
         // Every second item, move to a new line
         divs += @"<div style=""clear:float;"" />"
      }  

      divs += @"  <div style=""float:left;  width:400px; margin:10px auto;background:yellow;">
                        <div style=""width:80px; height:80px;background:red;""
                             <a href=""#"" class=""screenshot"" rel=""images/"+item["namee"].ToString()+@".jpg"" ><img src=""images/" + item["namee"].ToString() + @".jpg"" width=""80px"" height=""80px""  /></a>
                    </div>";
        if(id < 1){
        divs += @"  <div style=""width:231px;height: 40px;background:blue;"">
                            <p style="" margin-top:10px; margin-left:20px; ""><input type=""radio"" name=""SSRI"" value=""" + item["namee"].ToString() + @""" /></p>
                        </div>";
        }

        divs += @"<div style=""width:231px; height: 40px;background:green;"">

                        </div>
                    </div>";
    }
    Response.Write(divs);
int currLine=0;
foreach(ds.Tables[0].行中的DataRow项)
{
如果(当前行%2==0)
{
//每隔一秒,移动到新行
divs+=@“”
}  
divs+=@”