![]() The first page load code is this: protected void Page_Load(object sender, EventArgs e) Now, either the c# tag was added after I started typing this, or I missed it.īut, the c# code is much the same. So, it is a bit of code, but what jQuery.UI is "grabs" that div, and converts it into a nice dialog. Ok, now the hard part, the jQuery UI is a java script routine, and it is this: and note when we happy with the div layout, we add display:none to hide the div. It will be rather simple, and just combo box (for city), a text box for hotel anme, and a check box for "active only" filter. Ok so, we have to create a div to hold our pop up. The part to pop the dialog (jQuery.UI), and then the standard code server side. Now, the two buttions in the grid heading will have TWO parts. Using cmdSQL As New SqlCommand(strSQL, M圜on) Using M圜on As SqlConnection = New SqlConnection(My.Settings.TEST3) Public Function MyRst(strSQL As String) As DataTable GHotels.DataSource = MyRst("select * from tblHotels where id = 0")ĬboCity.DataSource = MyRst("SELECT City from tblCity ORDER BY City")Ĭ(0, "") ' allow blank selection My page load code to load the grid? Well, we want the heading to dispaly, so we do it this way: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load (I often suggest using a listview, since you don't need the template(s). Now, you can see in above, the markup starts to grow - that's due to gridview requiring "template" around each set of controls. This lets us setup the header with a button, or whatever we feel like. So I have to drop a few of the databound fields, and use a template for that one column. But, we need to add some buttons to the heading. So, how would this work, and look? (and keeping the above considerations in mind (only one post-back allowed in the pop dialog). The popup will allow the user to type in the first few characters of the hotel name OR WE can select a city from a drop down list to filter the grid by city.Īnd we toss in a show only "active" records with a check box. So, lets assume we want to pop up a dialog to filter a grid. If you do need some things to respond in that dialog, then you in most cases have to write ajax calls - that is extra pain and workload for the developer. So in most cases such a popup form is fine, but do keep in mind this limitation. So, you can easy pop a form, the user can edit (or enter data), but then you only allowed ONE post-back button event (say "ok - save"). So if the form you popup is to have some rich verification code, or code that requires some server side event code to run? You tend to be out of luck. ![]() The next consideration is that popup form cannot have post-backs. However, the form you pop up might be to edit data. This works great since is responds to a "click" very fast (you don't even have to hit the server for the dialog to pop-up. So, the way we do this is you create (usually) a "div" on the page that is a popup. ![]() You can use nueget to install it, or simply go to the jquery site and download the jQuery.UI files. It is without a doubt your site and application has jQuery, so, I would add jQuery.UI. However, probably the best choice is to use jQuery.UI. ![]() If you using the AjaxControlToolKit, they have a fantastic pop up extender, and it takes no JavaScript.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |