1

The Webpage requires that the Buttons be dynamically generated (in the code-behind C# file) based on the Files present in a directory. Now, the file name has to be passed to a C# function. Is it possible to do this? Is there any way we can invoke through the html Button? I've tried this :

ResultList.Append($@"<button runat = ""server"" class = ""btn btn-primary"" PostBackUrl = ""../Results.aspx"" OnServerClick = ""RedirectWithResParams"">Get Result</button>");

The Function that has to be called :

public void RedirectWithResParams(object sender, EventArgs e)
    {
        Response.Redirect($"../Results.aspx");
    }

I don't find a way it can execute. And also, I need a parameter to be passed to the above C# function. Is it possible, in some way, that it can be accomplished?

  • 1
    https://stackoverflow.com/questions/6187944/how-can-i-create-a-dynamic-button-click-event-on-a-dynamic-button – Benjamin Jun 11 '18 at 17:28

0 Answers0