-2

私はこのトピックについて多くのおしゃべりを見てきました。例と望ましい結果は常に非常に具体的で専門的ですが. これに関する方向性は高く評価されます。私のコードでは:私は動的に生成された画像と画像のURLです。そして、この画像コントロールをパネルに追加します。画像のURLをtemp()の引数に入れたいのですが、どうすればこれができるのかわかりません

<td align="center" colspan="2" style="height: 200px; ">
     <asp:Panel ID="Panel_pic1" runat="server">
     </asp:Panel> 
</td>

コードビハインド:

var lasToThirteenthUploaded = ds.Tables["title"].Rows[ds.Tables["title"].Rows.Count - 13]["id"].ToString();
int ID13 = Convert.ToInt16(lasToThirteenthUploaded);//row.Field<int>("video_id");
Image img13 = new Image();
img13.ID = "image" + ID13;
string title13 = ds.Tables["title"].Rows[ds.Tables["title"].Rows.Count - 13]["title"].ToString();//row.Field<string>("title");
img13.ImageUrl = ds.Tables["title"].Rows[ds.Tables["title"].Rows.Count - 13]["path"].ToString();// ("image_path");
Panel_pic13.Controls.Add(img13);

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
    if (Session["Name"] == null)
    {

    }
    else
    {
        temp();
    }
}
protected void temp()
 {

 }
4

1 に答える 1

0

ここから値を渡します

else
{
temp(img13.ImageUrl);
}

そしてそれをつかみます

void temp(string imageurl)
{
}

protected void temp(string imageurl) も使用できます

于 2013-04-15T16:48:28.410 に答える