Last post Jun 25, 2008 06:55 AM by Peter Bucher
Jun 23, 2008 07:40 AM|tomar99|LINK
I would like to create a button dynamicaly and assign an onclick event. This event is a redirection.
this is my code :
Button btn = new Button();
btn.Text = "Go !";
btn.CommandArgument = reader.GetOracleValue(0).ToString();
btn.CausesValidation = false;
btn.Command += new CommandEventHandler(btnDynamique_Command);
TableCell tCellbt = new TableCell();
I also tried with the parameter "PostBackURL" but I use SharePoint and there is a problem with it.
The code works with an other page, that's why I don't understand..
If you have any ideas..
Jun 23, 2008 10:03 AM|blurearc|LINK
This is the way i use and it's quite a standard. But it seems you are trying to use this in some sort of data binding. can you please reveal more what your are trying to do ..
As i have only used CommandArgument in the gridview or data grid. and where have you set the commandName
Jun 25, 2008 03:31 AM|Peter Bucher|LINK
Assign a ID to your Button and write the code - in the best case - to Page_OnInit.
That should works.
What kind of issue coming up with Sharepoint and PostBackUrl?
Jun 25, 2008 05:01 AM|tomar99|LINK
It wasn't call during the page_load..
When I use PostBackUrl with SharePoint, it redirects me on the good url but I have to refresh the page (when I click, SharePoint says "the page change, you need to refresh the page....", I click on the link and after, I'm on the good page). Every time I
have this message. That's why i need to use an other solution. And with buttons, it works !
Jun 25, 2008 06:55 AM|Peter Bucher|LINK
PostBackUrl makes a PostBack to another site, that means, the site is chancing.
That means fourther, you have to do a full rountrip / refresh.
Thats the theory, AFAIK.