什么字符串传入Arguement Class [英] What String pass in to Arguement Class
本文介绍了什么字符串传入Arguement Class的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经看过很多关于这个主题的喋喋不休。虽然这些例子和期望的结果总是非常具体和专业。任何方向都是值得赞赏的。在我的代码中:我是动态生成的图像和图像URL。并在面板中添加此图像控件。我想将图像网址放在temp()的参数中但我不明白我该怎么做
< td align =centercolspan =2style =height:200px;>
< asp:Panel ID =Panel_pic1runat =server>
< / asp:Panel>< / td>
代码背后:
var lasToThirteenthUploaded = ds.Tables [ title]。行[ds。表[ 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 [ 标题]。行[ds.Tables [ title]。Rows.Count - 13 ] [ title] .ToString(); // row.Field< string>(title);
img13.ImageUrl = ds.Tables [ title]。行[ds.Tables [ title]。Rows.Count - 13 ] [ path]。ToString(); / / (image_path);
Panel_pic13.Controls.Add(img13);
受保护 void ImageButton1_Click(对象发件人,ImageClickEventArgs e)
{
if (会话[ 名称] == null )
{
}
else
{
temp();
}
}
受保护 void temp()
{
}
解决方案
执行以下操作
受保护 void ImageButton1_Click( object sender,ImageClickEventArgs e)
{
if (Session [ 名称] == null )
{
}
else
{
temp(img13.ImageUrl);
}
}
protected void temp( string imgUrl)
{
// 这里u可以简单地使用变量imgUrl
}
希望它可以帮到你.....
I''ve seen a lot of chatter on this topic. Though the examples and desired outcomes are always very specific and specialized. Any direction on this is appreciated. In my Code: I am dynamically generated image and image URL.And add this image control in panel.I want to Put Image url in argument of temp() but i dont understand how can i do this
<td align="center" colspan="2" style="height: 200px; ">
<asp:Panel ID="Panel_pic1" runat="server">
</asp:Panel></td>
Code Behind:
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()
{
}
解决方案
Do the following
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (Session["Name"] == null) { } else { temp(img13.ImageUrl); } } protected void temp(string imgUrl) { //here u can simply use the variable imgUrl }
Hope it helps you.....
这篇关于什么字符串传入Arguement Class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文