开发者

How to get the link dynamicallY?

I have one problem.I have some directories which contain text files.I have read the full path of the directory and got the last one which contain the text file.Now I have dynamically ctreated the link to this directories and displayed them on the page.Now my 开发者_如何学编程problem is how to fetch the data from the text file contained inside the folder? As the buttonlink which I have created is dynamic I cannot handle the event on it.. So can anybody help me sort out this problem?

Thanking Each 1 of you,

Swapnil


I will assume that the LinkButton controls are created in your code-behind. Then you can set up a click event handler like this in your code-behind file:

public LinkButton_Click(object sender, EventArgs e)
{
    LinkButton button = sender As LinkButton;
    // button is now the clicked LinkButton; get whatever you need from it
}

When you create the LinkButton controls, attach the event handler to them:

LinkButton newButton = new LinkButton();
newButton.Click += LinkButton_Click; 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜