I created suppose 10 buttons dynamically......
how to get ID of a clicked button
protected void Page_Load(object sender, EventArgs e)
for (int i = 0; i < 10; i++)
Button b1 = new Button();
b1.ID = "b" + i.ToString();
b1.Click += b_Click;
in event hander of click how to retrieve the ID of clicked button.....
any ideas to implement it in c#.
Abdul Rahaman Hamidy
I have created imagebutton as imagebutton im =new imagebutton and set its image url and add it to placeholder and click event is fired but i want to display the clicked image buttons image but its displaying the last placed imagebuttons image . how can i spolve it .pls give me a soln
I have tried a lot sir . am just a student
my code is like this
string path = MapPath("~/cards/");
string full = path + Session["file"] + "/";
string s = Directory.GetFiles(full);
//Label1.Text = full;
foreach (string str in s)
string f = Path.GetFileName(str);
ImageButton im = new ImageButton();
im.Width = 150;
im.Height = 150;
Are you trying to change the image of the imagebutton after clicking it.
If yes where are you doing this?
-is editor.aspx is same page where you are creating your imagebutton?
What is your actual requirement.Not clear here?
editor.aspx is another page which shows the image of the clicked image button. my requirement is to show the image of the imagebutton am clicking but after clicking on the imagebutton i get the last imagebuttons image on editor.aspx.i want the image of the imagebutton which i have clicked . have used the session[selected"] to get the value of the selected imagebutton to the next page.but am getting the last ones sessionvalue
i an having a data table it contains lakhs of records, when i am getting this data, my browser is becoming slow.
how can i get the data to a specific range(example :1000 at one time)paging concept will work for this....
I actually suggested it because in the given scenario ,its having lakhs of records which is not feasible to store at server memory and if its going to be user specific then its going to hazardous for the server and performance of application
In all it depends on the requirement and the size of data
I've tried it with and without the Server.MapPath.
The resault without the server.mappath was "The SaveAs method is configured to require a rooted path..bla bla bla"
With the Server.MapPath it works but not the way i need it. as i said it inserts only the file's name to the DB.
The FileUpload control has a SaveAs(string path) method. You can use that method to save the file to any path using any filename you want. Just make sure ASP.NET has permissions to write to that path. So, you can do something like this to save the uploaded file to the uploads folder in the root of your website: