Hi all,
I am new to the UltraWebGrid and need some assistance understanding how the grid interacts with a user control that is used as the RowEditTemplate. I have defined a very simple user control, for my testing, that contains a textbox, 2 dropdowns, and a checkbox. In the user control's Page_Load event I load the data for my drop downs.
I have also loaded the user control as a template and have associated the user control with the grid's RowEditTemplate.
When I double click on the row in the grid, the template comes up and my drop downs are populated, but not selected. My questions are:
Is this documented anywhere?
Thanks
The most important point I can mention here is that the row edit template of WebGrid essentially has no server-side presence. The template is discarded and recreated on each postback. The best reason that I can think of to make use of a user control for a row edit template is if you want to re-use the same template for multiple WebGrid instances.
sseelam said:1. I need to retrieve additional information from the database for the row that is being editted and add that data to the user control. What event can I use to do this? Would it be an event on the grid or on the user control? Can I access the grid's DataKey's from the user control?
sseelam said:2. I need to populate the user control with the row that was selected. I see the columnKey attribute, but it only seems to work for controls of type textbox. How do I handle the checkbox and dropdown controls?
For other controls, including your dropdown controls, you'll need to copy the data from the grid when the template is opened, and back from the template to the grid when the template is closed. This process is described in the following article from our online Knowledge Base:HOWTO: Placing complex controls into the RowEditTemplate
sseelam said:3. Can I put validators on the user control, that can validate my user's input?
Vince,
This is a great post. I am teaching myself ASP.net and javascript after being strictly a winforms developer for the past 9 years. I love the Infragistics controls and have brought them to the couple of companies I worked for those years. This RowEditTemplate has been coming in very handy in a recent project I am developing and is working flawlessly for me once I get the code figured out. There has been something I am getting stumped on but I found a round about way of handling it. The WebGrid I am using is way down in the heirarchy of control containers(you can see by the id I need to use to refrence the dd list on the grid:
ctl00$ContentPlaceHolder1$UltraWebTab1$_ctl1$uwtEmpDetails$_ctl0$ugCategory$ctl00$ddCategory
The grid is on a UltraWebTab which is on a WARP which is on a UltraWebTab which is on an ASP.Net MasterPage. Normally I am able to get refrences to controls using <%=ddCategory.ClientID> but can't seem to with the DropDownList on the grid. Do you know of any other way of getting the refrence to the DropDownList on the grid instead of opening the DOM tree in the IE Developer tools and figure out what name/id has been given to it?
Thanks and keep up the great work!
Steve