문제

I created an ImageButton in code buhind-

var img = new ImageButton();
img.ID = "Del" + i.ToString();
img.ImageUrl = "images/1395958363_meanicons_57.png";
img.Width = 48;
img.Height = 38;
img.OnClientClick = "javascript:void(DeleteBook())";

Label1.Controls.Add(img);

Now I need to get the ID of the ImageButton. Can anyone help me with this?

P.S The ImageButton was creates in "for", so I don't know how mutch ImageButton I have and what is them ID

도움이 되었습니까?

다른 팁

you can pass the img.ID into the javascript DeleteBook() function directly.

or better yet you can pass this directly eg: OnClientClick ="DeleteBook(this)"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top