Click here to Skip to main content
15,912,329 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Format String for Decimal {0:D2} Pin
OldDog.Net4-Oct-06 2:52
OldDog.Net4-Oct-06 2:52 
AnswerRe: Format String for Decimal {0:D2} Pin
Guffa3-Oct-06 9:51
Guffa3-Oct-06 9:51 
GeneralRe: Format String for Decimal {0:D2} Pin
OldDog.Net4-Oct-06 2:56
OldDog.Net4-Oct-06 2:56 
AnswerRe: Format String for Decimal {0:D2} Pin
Guffa4-Oct-06 6:07
Guffa4-Oct-06 6:07 
QuestionProblem with ButtonEvents on dynamic UserContols Pin
Ibana3-Oct-06 7:44
Ibana3-Oct-06 7:44 
AnswerRe: Problem with ButtonEvents on dynamic UserContols Pin
e-laj3-Oct-06 11:33
e-laj3-Oct-06 11:33 
GeneralRe: Problem with ButtonEvents on dynamic UserContols Pin
nguyenvhn3-Oct-06 17:31
nguyenvhn3-Oct-06 17:31 
GeneralRe: Problem with ButtonEvents on dynamic UserContols Pin
Ibana5-Oct-06 12:52
Ibana5-Oct-06 12:52 
Thanks for the reply and detailed answer e-laj!

I have been away for a couple of days so I havn't been able to reply until now. Anyway I have made some progress:



1. I load the controls in Page_Load and assign them unique ids within
not PagePostBack.
2. I put the control into the viewstate (to load when page is post back)


The events wont fire the first time but the second time they do.
It still seems to be something wiht the lifecycle.

Could you explain some more about the TrackViewState?


<br />
	if(!Page.IsPostBack) <br />
	{<br />
				<br />
	 RequestDataFromPostMessage();<br />
				<br />
Domain [] domainCollection = GetInformationFromWebSevice()<br />
<br />
//Length=How many usercontrols to create<br />
domains=domainCollection.Length;<br />
ViewState["domains"]=domains;<br />
DomainControls = new DomainControl[domains];<br />
			<br />
for(int i=0;i domains;i++) <br />
{<br />
DomainControls[i]=(DomainControl)LoadControl "DomainControl.ascx");<br />
<br />
//Init the usercontrols within the specific usercontrols, the controls actually raising the events<br />
DomainControls[i].InitSubDomainData(.......);<br />
<br />
//unique ID<br />
DomainControls[i].ID=i.ToString();<br />
Session["DomainControl"+i.ToString()]=(Control)DomainControls[i];<br />
placeHolder1.Controls.Add(DomainControls[i]);<br />
						<br />
<br />
	}<br />
}<br />
<br />
//if post back<br />
else <br />
{<br />
domains = (int)ViewState["domains"];<br />
DomainControl dControl = new DomainControl();<br />
for(int i=0;i<domains;i++) <br />
{<br />
dControl = (DomainControl)Session["DomainControl"+i.ToString()];<br />
placeHolder1.Controls.Add(dControl);	<br />
}<br />
				<br />
}<br />


The debugger crahses in the Onclick event method in the usercontrol while debugging.
protected void Open_Click(object sender, System.EventArgs e) {<br />
....do something<br />
}<br />


Any suggestions?
Thanks!
AnswerRe: Problem with ButtonEvents on dynamic UserContols Pin
e-laj5-Oct-06 21:45
e-laj5-Oct-06 21:45 
Questionhow make make sorting and paging both work togeather? Pin
jwrz200t3-Oct-06 6:27
jwrz200t3-Oct-06 6:27 
AnswerRe: how make make sorting and paging both work togeather? Pin
laocat20036-Oct-06 5:06
laocat20036-Oct-06 5:06 
Question(Ultra)WebTabs from Ingragistic Pin
julie763-Oct-06 6:22
julie763-Oct-06 6:22 
AnswerRe: (Ultra)WebTabs from Ingragistic Pin
Member 964-Oct-06 13:23
Member 964-Oct-06 13:23 
QuestionWrong button clicked when user presses "Enter" key Pin
Goalie353-Oct-06 5:28
Goalie353-Oct-06 5:28 
AnswerRe: Wrong button clicked when user presses "Enter" key Pin
ToddHileHoffer3-Oct-06 5:47
ToddHileHoffer3-Oct-06 5:47 
QuestionHow to get Focus on one Button,if two buttons exists on the same form Pin
ravindradonkada3-Oct-06 3:07
ravindradonkada3-Oct-06 3:07 
AnswerRe: How to get Focus on one Button,if two buttons exists on the same form Pin
Sathesh Sakthivel3-Oct-06 3:15
Sathesh Sakthivel3-Oct-06 3:15 
AnswerRe: How to get Focus on one Button,if two buttons exists on the same form Pin
ToddHileHoffer3-Oct-06 4:55
ToddHileHoffer3-Oct-06 4:55 
AnswerRe: How to get Focus on one Button,if two buttons exists on the same form Pin
vikram1383-Oct-06 17:36
vikram1383-Oct-06 17:36 
Questionpage load event not called Pin
Deepak the Cool3-Oct-06 1:23
Deepak the Cool3-Oct-06 1:23 
AnswerRe: page load event not called Pin
CWIZO3-Oct-06 6:37
CWIZO3-Oct-06 6:37 
QuestionWebservice and COM object Pin
Talal Sultan3-Oct-06 1:22
Talal Sultan3-Oct-06 1:22 
QuestionAvoid Datagrid Refresh Pin
kavithapuranik3-Oct-06 0:40
kavithapuranik3-Oct-06 0:40 
Questionhow to make web application DDA compliant ? Pin
King Shez3-Oct-06 0:32
King Shez3-Oct-06 0:32 
QuestionProblem With Hosting Pin
alokdotnet3-Oct-06 0:16
alokdotnet3-Oct-06 0:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.