| |
|
|
Plague2006
: On
April 18, 2008 7:59 AM
said:
|
Hi, Some questions I have regarding this documentry. I assume that Shared keyword is the equivalent to Static in C#. And under that assumption, I raise the question on how the value modification will affect when multiple users are using the page simultaneously. When the value is increased by one user clicking on the button, won't that affect the other users who may not have clicked the button? I'm not criticizing but trying to understand. I hope you can clear it up for me.
|
|
|
|
DamijanD
: On
April 18, 2008 3:51 PM
said:
|
Yes in real world static would cause troubles. You should use session instead.
|
|
|
|
SergeyS
: On
April 18, 2008 11:10 PM
said:
|
Why video? Why not regular article? Even more extensive comments of the code would be much better off. Anyway you've spent more than half an hour on the video. How this is to be handled by search engine? Why is it better for a developer to spent a lot of time downloading 100M video, then spend 0.5 hour to look through it, than just to spend 5 min to grasp the written idea? Millions of ASP.NET developers can't get spoken English. Is it oficial MS position to phase them off the MS road?
|
|
|
|
loveASPNET
: On
April 19, 2008 6:00 AM
said:
|
Hello Joe, Your presentation was really cool. Can you demonstrate the same with the use of usercontrols. like how we can add usercontrols dynamically and keep the viewstate of the usercontrols inbetween postbacks. Thanks, Robin
|
|
|
|
Dollarjunkie
: On
April 20, 2008 2:20 AM
said:
|
Hi Joe, following the request from the last poster, I would appreciate it if you actually give some information on dynamically adding Usercontrols and removing usercontrols from page.
|
|
|
|
JustAnotherGuy
: On
April 21, 2008 10:56 AM
said:
|
Hi Joe, Just tried building a page like the one in this video but using a dropdownlist instead of the button. But I am getting an issue in the GetPostBackControl function. The ctrlName property populates with the clientid of the dropdownlist control but then the findcontrol function return nothing when looking for it. I have tried stripping the ctrlName down to just the dropdownlistname by breaking the returned name into an array but it still returns nothing. My page uses a master page but all of the code and controls are in the aspx and codebehind of the aspx. Any thoughts?
|
|
|
|
JustAnotherGuy
: On
April 21, 2008 11:48 AM
said:
|
The demo code from this video does not work once you place it all in an aspx page that has a master page (even if the master is completely empty). The FindControl in GetPostBackControl returns nothing. Does anybody have any thoughts on how to resolve this? This is useful code but I need it to work in a masterpage situation.
|
|
|
|
kentto
: On
April 23, 2008 1:04 AM
said:
|
@JustAnotherGuy I'm assuming it's not finding the controls because the ContentPlaceHolder is a container control that's on the Master Page and not on the Web Form, try passing the Master Page instance by changing the line in the Page_PreInit to Control myControl = GetPostBackControl(Master.Page); and the comparison to take into account that the container will be prefixed to the control name of btnAddTextBox to something like if ((myControl.ClientID.ToString().Contains("btnAddTextBox"))) and see if that helps.
|
|
|
|
JohnYahoo
: On
April 23, 2008 1:40 PM
said:
|
Joe This is a superb demonstration of something I have been trying to do for some time. In the past I have had to resort to fat client programming to do this. Thank you. Thank you. There is a saying "No good deed goes unpunished" so I must address some of the comments above. >>>"Millions of ASP.NET developers can't get spoken English."<< I often watch these videos with the sound turned off. You can still get everything that happens if you watch closely. Isn't this video format ideal for people of all languages? I think so. >>"Why video? Why not regular article?"<< There are plenty of regular articles out there. None of them can show the complete picture of the solution like a video. The video leaves nothing to figure out. It is all there, even if the sound is off. Somebody is going to complain, regardless of what you do. If it is visual, the blind people will be hurt. If it is audio, the deaf people will be hurt. If it is available on some day of the week, it offends somebody's religion. There would be fewer complaints if the language were Esperanto, because almost nobody would view the page. And why not Cobol? Or RPG? Don't you know you are offending the Linux community? This has become one of my favorite web sites. I would like to see it survive and thrive. It really hurts me when people slam it with bogus unfounded criticism.
|
|
|
|
jonny75904
: On
May 02, 2008 3:04 PM
said:
|
Hi Joe, I am trying to use this example to create tabs dynamically. The C# source does not build (it says MyPlaceHolder does not exist in the current context). I'm fairly stupid and am unable to solve this problem. HELP!
|
|
|
|
ansrikanth
: On
May 19, 2008 8:01 AM
said:
|
Hi Joe, I do strongly agree with JohnYahoo... Yes, Video will definetly gives good impact than a simple article, the way you are telling abt each and every line is really impressive. Thats really great job from you.. I have already commented about this in the blog.. You have gone through a static variable.. which is really dangerous in Web applications( as per my best of knowledge ).. isn't there any other possiblity w/o using static.. i have tried Session variable but it failed, co'z i read some where that, Session varible will be come into picture after the page gone through complete life cycle.. not at the time preinit.. Please do suggest me the work around for this...
|
|
|
|
thanwa
: On
May 21, 2008 3:52 PM
said:
|
Hi Joe, Your presentation is awesome. Thank you very much. But have you ever got the following error?: =================================== System.InvalidOperationException was unhandled by user code Message="RegisterRequiresControlState can only be called before and during PreRender." =================================== Error occurs when I try to add new control to PlaceHolder. I used the same approach but I'm working with Gridview instead of Textbox. I can render the page at the first load but when I hit the button to add more Gridview into the page, I got this error. Here is the section of the code I use to add every Gridview to PlaceHolder: =================================== Dim gv As GridView For Each gv In loadedGridView myPlaceHolder.Controls.Add(gv) Next =================================== loadedGridView is an array of Gridview and I create it during "OnInit(ByVal e As EventArgs)". I'm not sure if I should put the whole source code here but if you need to see the full source, I can do it. Thank you, Thanwa
|
|
|
|
jagannath
: On
June 25, 2008 5:01 AM
said:
|
Hi Friends, I would like to need complete video tutorial of expreesion blend,vs2008,silverlight2 beta step by step.. Thank u
|
|
|
|
jimdgilbert
: On
June 27, 2008 5:31 PM
said:
|
SergeyS : On April 18, 2008 11:10 PM said: Why video? Why not regular article? Did SergeyS happen to notice that he was in the ASP.NET AJAX Videos › section?? Why on Earth would you browse the video section, and then complain because there is a video, IN the video section?? Joe, you just keep banging out the videos. For me, it shaves tons of time off figuring out how to use tools when I watch you step me through them in the videos. Thank you for all you do for us.
|
|
|
|
zcumbag
: On
July 09, 2008 10:33 AM
said:
|
What about removing an item? I thought it would be fairly similar but I end up with errors...
|
|
|
|
mark_bert
: On
July 17, 2008 4:25 PM
said:
|
I'm in process of implementing the ideas in the presentation inside a wizard control with user controls. Regarding several posts in this thread, here are a couple thoughts: 1. The use of STATIC for the counters holds the state across multiple users/sessions. I implemented a session variable that seems to be working fine. 2. To use user controls, you need to add a reference to the control in your .aspx page like this: <%@ Reference Control="userControls/myUserControl.ascx" %> Then in your codebehind reference the class from the UC like this: myUserControl offenderAddress = (address)Page.LoadControl("userControls/myUserControl.ascx" );
|
|
|
|
lbk
: On
August 04, 2008 8:48 AM
said:
|
Hi, I have a problem getting the code to work, when placing the “Add TextBox” button in a tabcontainer, the GetPostBackControl returns null, causing the textbokses to loose content, and no textbokses are added. Everything works fine when the button is placed ouside the tabcontrol. Any ideas?
|
|
|
|
John Jiang
: On
August 04, 2008 3:30 PM
said:
|
what this sample has anything to do with Ajax? We can do this in asp.net 1.0
|
|
|
|
cv_vikram
: On
August 08, 2008 9:18 AM
said:
|
Its a good tutorial thanks....
|
|
|
|
JonasButt
: On
August 16, 2008 8:29 PM
said:
|
I don't really think this a best practice of how one should dynamically add controls to a ASP.NET web page. 1. As pointed out in the first comment, using the global counter variable will not work well when multiple users will be using the page simultaneously. Storing this in the Session object would resolve this. 2. Furthermore, why would you create such an elaborate piece of code to determine what caused the page request? Isn't a click event handler of the button fit for this purpose?
|
|
|
|
chan29
: On
September 02, 2008 1:34 PM
said:
|
JonasButt: In #2, are you talking about the LoadControl method from the Page object? I respect your opinion about this video but I don't see anything from you that is helping others. Can you post an example on how you would do this?.
|
|
|
|
JonasButt
: On
September 06, 2008 12:36 PM
said:
|
chan29: I do not specifically mean the LoadControl method call. I mean the entire routine that was demonstrated to detemine which control caused the postback. I would suggest to simply add a Click event handler to the button. When the button is clicked, you can handle the dynamic creation of controls in its event handler. Here is an example: ASPX ================================================
</asp:Panel> CodeBehind C#: ================================================ protected void addTextBoxControlButton_Click(object sender, EventArgs e) { int dynamicTextBoxCounter = Session["dynamicTextBoxCounter"] == null ? 1 : (int)Session["dynamicTextBoxCounter"] + 1; for (int i = 0; i < dynamicTextBoxCounter; i++) { TextBox newTextBox = new TextBox(); newTextBox.ID = "dynamicText" + (i + 1); newTextBox.Text = "ID = " + newTextBox.ID; dynamicTextBoxesPanel.Controls.Add(newTextBox); } Session["dynamicTextBoxCounter"] = dynamicTextBoxCounter; } Remember, the point of the video was to "demonstrate a technique to dynamically add an indeterminate number of controls to your web page". This is exactly what my example demonstrates.
|
|
|
|
evisser
: On
September 07, 2008 11:55 AM
said:
|
I just want to compliment Joe on this video and agree on the comments that are similarly positive on a video approach . Great job done! Especially since I have been strugling with this problem for a number of weeks, on and off adding more and more complexity and then dropping the whole subject. Since I am fairly new I also appreciate the very technical comments that were dropped here. Especially on this Shared use. It leaves indeed a problem for concurrent users, but hey I think I can even find a bypass for that ( I thought about a session variable). One remark though: Is there a dependency on Ajax? I cannot grasp the concept why this has to be AJAX-ed. Appreciate some feedback on that. Maybe I will find out with trial-and-error. -Eric
|
|
|
|
pitikpiyik
: On
September 16, 2008 3:02 AM
said:
|
all of the video are cool... i want to ask about my problem with adding dynamic control...i cant find the control inside tab container in nested masterpage (2 masterpage) cant u help me to resolve this problem, i try to use many way in this forums but still cant find the solution...please help me and reply my message as soon as posibble thx
|
|
|
|
marko
: On
October 16, 2008 2:59 PM
said:
|
how to do that for usercontrol
|
|
|
|
marko
: On
October 17, 2008 9:29 AM
said:
|
can you also put code(on button click event) for removing controls from page from latest textbox to first one...
|
|
|
|
cnbc
: On
November 28, 2008 1:58 PM
said:
|
Hi Joe, very nice video. I extend with add/remove. It is works perfect. but I still can not understand clear this function which is Shared.... 1. When is it usefull to use shared functions in ASP.NET? 2.What happens when multi users use this functions at the same time? The benefit to be in heap memory is clear for me ,what are THE side effects, if any? msdn.microsoft.com/.../zc2b427x.aspx Rules Declaration Context. You can use Shared only at module level. This means the declaration context for a Shared element must be a class or structure, and cannot be a source file, namespace,or PROCEDURE :-(. Please advise. I really need to go deep in this Thanks
|
|
|
|
LankyStreak
: On
December 06, 2008 5:07 AM
said:
|
Hi Joe, Thanks for an excellent video. I just Googled for "asp.net ajax dynamically add controls" and there you were, right at the top, explaining how to do exactly what I've been looking for. I like your presentation style, and the speed of the demonstration was perfect. It was like sitting with a colleague explaining it. Thanks again!
|
|
|
|
itchamp2100
: On
January 07, 2009 6:54 PM
said:
|
If you create all controls again on each Async. postback then how is it keeping the value of that control. I just wanted to know the reason behind that. Although I already knew the same thing and applied to projects but I liked your video. It took me days to learn this thing. [:)]
|
|
|
|
praveenrajr
: On
January 08, 2009 12:46 PM
said:
|
I am not sure about the life cycle of the asp.net properly. I had trouble understanding this preinit and init and why we had init as override and preinit as protected method. Is there any link where i can look into this.
|
|
|
|
arjirevanth
: On
March 14, 2009 5:17 AM
said:
|
Excellent Article.. it was amazing.. i have trying for this since 3 weeks at last i go it. Thank you very much..... 1 Question how to handle Page_PreInit in User Control, Because my all code is in User control.
|
|
|
|
krishnachaithanyakotte
: On
March 18, 2009 12:18 PM
said:
|
Dear All , I have been working out with an web application where i have used ajax control toolkit tab panels . In the tab panels i am creating dynamic controls (textboxes & Literals) for entering infinite email ids. The Dynamic controls are being created but i am not able to retrieve the values entered in the dynamic textboxes . Actually i have created these dynamic controls using the video tutorial from www.asp.net/ajax/ and i have checked it separately without using tab panels i am able to retrieve the values of the dynamic textboxes , but when i am using the dynamic controls in the tab panels im getting this problem . Please Help me out in this regard . Thanks & Regards , LotOfBugs
|
|
|
|
Lareman
: On
March 28, 2009 4:19 AM
said:
|
Joe, Gr8 video! I have to build an application with an indeterminate amount of fields and really didn't want to go the Javascript route for security as well as consistency. I like how you explain everything in detail. Once I build this section of the form, I'll have to deal with integrating it into a master page but I won't worry about that until it's time. :)
|
|
|
|
Veronka
: On
May 22, 2009 1:04 PM
said:
|
This example is great! I tried both the sample demonstrated here and then moved everything on a form using a master page and works just fine. Awesome! Thanks.
|
|
|
|
khalilmo
: On
June 06, 2009 8:40 AM
said:
|
Perfect work Joe; I've implemented it successfully with additional improvements, but here i have a question please! How to check if the textbox is empty or not, before accept the adding of a new one, so the add button will refuse adding a ney textbox if the previous one is empty? many thanks.
|
|
|
|
activemode1
: On
June 07, 2009 10:08 PM
said:
|
Enlightenment comes in different forms. First and foremost, comprehension is the key to understanding. Then we rationalize what's useful to us, and what we don't need. Then we actually make use of the options we chosen. In the end we can't make a reasonably well informed decision, without knowing every other option available... Thanks for the information.
|
|
|
|
lostinsea
: On
June 30, 2009 4:18 PM
said:
|
Wow, I have been beating my head trying to figure out how to get around this exact problem. Detecting the control in preInit is exactly what I needed to know. Thanks Joe! Keep'em coming, loving your tutorials.
|
|
|
|
typhoonx
: On
August 08, 2009 3:10 PM
said:
|
I tested some codes. Plague2006 is right. Static variable will affect another users. The value is even cached when you open a new browser. I think a session variable is the way to go.
|
|
|
|
ovais_ashraf
: On
August 25, 2009 3:43 AM
said:
|
Hi. the video is excellent. can anybody tell me that when the webpage is debugged and changed, the script generated by AJAX is also change. i have a page which dynamically generates controls but the names of these controls becomes like "cnt001$PlaceHolder1$hyperlink1", how can i catch those controls???
|
|
|
|
liujunhua6
: On
September 03, 2009 2:44 PM
said:
|
On my form, part of the controls are static, and part of the controls are dynanmic. Among those dymnatical controls, there are textbox, dropdown list and checklist. I got an error message: Method 'Protected Sub Page_PreInit(sender As Object, ByRef e As System.EventArgs)' cannot handle event 'Public Event PreInit(sender As Object, e As System.EventArgs)' because they do not have a compatible signature. Please help!!
|
|
|
|
steppinthrax
: On
September 14, 2009 2:42 PM
said:
|
The problem is that this only works on the 3.5 framework...
|
|
|
|
edferron
: On
October 13, 2009 1:44 PM
said:
|
I love these videos. It is absolutely the way I learn quick 10-30 minute concepts.
|
|
|
|
induster
: On
November 05, 2009 4:20 AM
said:
|
@kentto Thanks for the solution for using this with master pages. Works perfect for a file upload control.
|
|