Programming is Passion,Software Development is an Adventure- Willy David Jr

Programming is Passion,Software Development is an Adventure- Willy David Jr

July 2007 - Posts

Good UI for End-User's Perspective is Still Important on Web Apps

 

It was a beautiful day when we prepare our web applications to demonstrate our 2-week project in front of our CEO, to our Project Manager, Test and Requirements team, and to the Software Development team leaders. The web application if passed accordingly to our Proof of Concept (POC), will be shift and be tested before deployment. I was so confident that I had made all the requirements given to us by the Requirements team. But too much confidence change everything. I received a lot of criticism. But why? The answer is "Bad User Interface"! Like the banner was too big and should be a text and not a picture so that it will look simple, some text in buttons where not properly labeled, even the buttons stylesheets where not properly monitored. It was really hard on my part, because I made almost all my time configuring how to program and develop every piece of information on my application but still, on the business world, no one uses CTRL key to create multiple selections for example. Everything is a mouse click away. And the simple the better. And everything must be accordingly design according to its background color and even the text and hyperlinks must be properly configured. All in all, despite the criticism, it takes me again to the next level of software development. This will be a good start as my learning experience and not a failure. Everything should be considered in developing software in the business world. So guys, keep your skills on what I will call designer-business capability up for you to catch a good UI Perspective on your Web Applications! Smile

 

Are you fast enough? Express Web Prix Challenge for All Student Developers!

 

Calling all students, are you fast enough to become an Express Web Prix Champion? Join now, there is still last Challenge 4 competition on going and the deadline is on July 16, 2007. Come on guys, show us your guts!

Actually, this post was a little bit late, but as far as I can see, there are few student developer's out there who are not aware of this competition, so I want them to see this one. I've joined Challenge 2, where you'll need to develop an online registration system. My major feedback here is that, the database you'll going to use is on the web server, and not on your local host where you can test it on your local machine. That's quite strange, because debugging will take few steps further. But I really love to compete in different kind of competitions like this, just like I compete on ImagineCup Software Design Competition. It was fun, challenging, and full of experiences. If I don't win, I don't lose either, because I gain knowledge. That's how I play my life as a Software Developer, and even in real life instances. So to all developers out there, here's our chance, to show the best move!

 Here is the link:

http://www.microsoft.com.ph/expresswebprix

 

Dynamically Loaded Web User Control and Session State

 

Loading controls is a pretty easy task, and creating them at run time is pretty simple. But how about loading them dynamically inside a control or somehow adding them on your list of child controls? Ahh, ahh, ahh, think again. Maybe it's an easier task to load them dynamically but using a Web User Control was not a great idea. It almost took me two to three days scratching my head on how to load these user controls dynamically without affecting the events, postbacks, and most importantly the sessions behind it. Waah, it was challenging!

To visualize it, I have a page which consists of 2 buttons. The two buttons serve as a navigation for 2 pages which is specifically a web user controls. The first web user control consist of a button and a textbox. The button fires up the string on the Session bag which is link on the textbox. The second web user control now contains only a textbox which shows the message on the Session memory. Additionally, we want to load those user controls on a Placeholder or a Panel, or even on UpdatePanel for AJAX integration.

So the question is, why is it so complicated on a simple situation like that? Well the answer is, at page load, the page is stateless, meaning, it has no idea about the dynamically loaded controls. In other words, if you click button one which loads the first user control, it's fine and working properly, but try to fire the event inside the first user control on which you loaded dynamically. Voila! Nothing happens! As if all the controls inside the first web user control is gone. That is now the problem. You cannot even fire up an event, even a single send of data on Session State.

 

So what did I do? First don't initialize your control on Button1_Click, because it will unload your web user control if you click their buttons:

 

Protected Sub Button1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Init

Dim ctl As Control = Page.LoadControl("Page1.ascx")

ctl.ID = "MyCTL"

PlaceHolder1.Controls.Add(ctl)

End Sub

 

On Button 2, you can now put it on button2 click event:

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)

Dim x As Page2 = CType(Page.LoadControl("Page2.ascx"), Page2)

PlaceHolder1.Controls.Add(x)

PlaceHolder1.Controls.Remove(ctl)

 

End Sub

 

And for the first user control, this will send the data on textbox onto Session bag:

 

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

 

Session("MySession") = TextBox1.Text
End Sub

 

And the second user control will load it on page load:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


Me.Label1.Text = Session("MySession")


End Sub

 

Now, you can navigate to two different user controls and can still fire an event handlers from them! What do you think guys? Any suggestions? Smile