Solved

Filtering based upon template field value

Posted on 2010-09-20
3
370 Views
Last Modified: 2012-05-10
Hi,

I have the following setup.  An ObjectDataSource which is used to populate a Details view control.

This is current used for inserting data.  One of the fields iwithin this is a template field into which I have placed calendar extender control.

Here is what I want to achieve. Add a gridview control on to the same page that when the page loads shows all of records from the table.  I then wish this gridview to be filtered when a user makes a selection from the date templatefield.

Thinking about this I need to first capture the event of adding a date.  I take it this will be on change event of the textbox rather then onClick of the calendar extender control.  Not sure how to access template field controls inside a details view?

Next I need some way of filter the ObjectDataSource of the new gridview.  I have setup a query that accepts a parameter but normally I can specify to take the parameter from a control, but in this case I won’t be able to because it’s inside a details view control.

Any help much appreciated.
0
Comment
Question by:andyw27
  • 2
3 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 33717971
Not getting the scenario you are trying to use these controls. Generally you use GV->Detailsview but here you are trying to use DV->GV.

You can find the control in DetailsViews like you would normally do.
e.g
TextBox tb = (TextBox )DetailsView1.FindControl("txtDate");

For setting the parameter value programmatically check this:
http://www.asp.net/data-access/tutorials/programmatically-setting-the-objectdatasource-s-parameter-values-cs
0
 

Author Comment

by:andyw27
ID: 33719183
Thanks, I still can't see how to do something on the event of a template field?

Your code allows me to find a control, great if I want to change it's attribute, but how for example could I access the onchange event?

Thanks again.
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 33719204
---> I then wish this gridview to be filtered when a user makes a selection from the date templatefield.
Where is your TB, inside GV? If you want to filter data, you can put that filter outside of GV.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question