ASP.NET message box - asp.net

I am looking for a custom control which could enable me to call message of following type.
http://extjs.com/deploy/dev/examples/message-box/msg-box.html
Is there a control which function like a .NET desktop application messagebox?
I know, exactly similar may not be possible but main features I am looking for here is returning value of clicked button and custom value entered by user in code behind.
I have also started working on it myself, but hardly any luck so far.. any direction in this case will also be very useful.

There is a good tutorial which could help:
Create MessageBox user control using ASP.NET and CSS
And here combining it with the AjaxControlToolkit:
ASP.NET Popup Message Box User Control
I hope this helps!

Have you looked at the AJAX Toolkit? It doesn't do all the things you want, but it should be too hard to the extender and controls needed into a CustomControl and create your own DLL.

use the namespace "System.Windows.Forms" by adding the reference to the solution explorer

Related

Validating a textbox with AJAX Toolkit in ASP.NET

I'm not really sure where or what to search for regarding the following question:
I have a TextBox control and a Label control on my page. I have a database query ready and I would like to run it on the TextBox textchanged event in order to display a "valid" or "not valid" text in the Label.
How can I achieve this without posting back the entire page on each textchanged event? I have installed the AJAX Control Toolkit and got the samples working but I don't seem to find an extender that would fit the bill. Any tips? Much appreciated, thank you.
Firstly, move away from the AjaxControlToolkit. This is for lazy web developers who dont know what they are doing.
Secondly, check out jQuery Ajax. Learn how to use it properly in order to do what you are needing to do.
Basically what you will need to do is post via jQuery Ajax to your page/webservice in order to run the database query. You can then return your data to the page and update the UI.
http://api.jquery.com/jQuery.ajax/

asp.net update panel and validators not working

I have created UserControl that contains a textbox and a restricted length validator for that textbox.
I'm adding user controls dynamically via UpdatePanel to my Parent WebForm. And the problem is that Validator just won't work. It just won't trigger.
I work on .net 3.5.
Does anyone have any clue what is happening and how can I make this validator work.
I have face similar problem and my validator in the detailsview-->updatepanel-->Validator
Check this thread for details
On the Client Click I have enable validator using javascript function
ValidatorEnable(document.getElementById('<%=rfv.ClientID%>'), true);
I too faced such an issue. I was using .Net 3.0 and VS2005. I referred to this problem discussion and the solution and could solve my issue. You too can refer the same.
As far as I understand it you can't add controls dynamically as this changes the page structure and .net gets confused. Instead you have to have all controls loaded "onLoad" and then simply change their visible flag to show or hide them as needed.
This way .net can keep track of them all and is happy.

Is there a way to add client methods to ASP.NET user controls?

I recently discovered the client-side methods of some of the controls in the Microsoft ajax control toolkit. For instance, with the TabContainer, I can do something like this:
$find('tabsEditJob').get_tabs()[1].set_enabled(true);
without having to resort to server side code. Is there a way to do this in your own custom user controls without too much work?
UPDATE: I was going to implement show and hide methods: although setting display to none would probably work just fine, they would prefer an explicit method. I know that the ajax control toolkit controls have a set_visible method. Do user controls get this too?
The approach the ajax control toolkit is a managed approach, so you should check out this walkthrough as a good overview of what it is and how you create it: http://www.asp.net/learn/Ajax-Control-Toolkit/tutorial-49-cs.aspx
There is both a server-side and client-side piece; it can be confusing at first, but it isn't that difficult to setup once you are used to it. But it does require some reading up on it first and a some considerable planning.
I've built a few of my own, and you have to think about all the interations you want to include and at what point certain pieces of code should run, all of the events, etc.
HTH.

How do I get design mode to work for templated user controls?

Is it possible to get design mode to work for templated user controls? I have tried following the How to: Create Templated ASP.NET User Controls on MSDN, and also tried the various tips at the bottom of page for version 2.0 of the framework, but alas, I still get the dreaded "Error creating user control" error, when switching to design view.
Should I just give up, and switch to a custom server control?
There is a Connect bug filed on this as well as several comments on the VS2005 version of the MSDN page. Apparently this is a long-running defect that hasn't been fixed and hasn't got a solution. In ScottGu's post about this feature, he acknowledges this doesn't work (in the comments) and points the commenters to the CompositeControl base class if they want designer support.
Probably not the answer you were hoping for, but it sounds like there's no real solution for the issue except moving to server controls.
I was never able to get it to work either. It can be done easily with a regular server control, though. I posted a quick example as an answer to this question:
ASP.NET: User control with access to the controls that it wraps

ASP.NET AJAX modal popup framework

I'm using ASP.NET 3.5 + Ajax Control Toolkit + jQuery (NO MVC yet)
I'm looking for a standard solution for showing a user control (.ascx) as a modal popup (like the Ajax Control Toolkit ModalPopupExtender implementation), where I can pass parameters to it before it opens. Then get some values on closing, and potentially handle events on the server.
I'm currently using a combination of the ModalPopupExtender and update panel to implement this each time I need it. It seems like it takes too much plumbing that has to be created each time.
Before creating my own packaged solution, I'm looking for an existing solution, or for a better pattern to implement this.
I've always set a hidden field value on clientside. My modalpopups data would have parameters that would come from that hidden field. This works great when you update the updatepanel.
function setfield(v) {
document.getElementById('<%=HiddenField2.ClientID%>').value = v;
}
But maybe this solution isn't a best-practice.
It didn't take me too much time to do this. Let me dig up my own implementation.
EDIT:
In it's simplest form, this is what I used. I could drop this into a UserControl and then drop that in any page I wished to use it.
Trying to self contain pop ups which use the AjaxToolkit ModalPopUpExtender
Not sure if this is the part you're wrestling with though.

Resources