Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Filtering based upon template field value

Posted on 2010-09-20
3
Medium Priority
?
374 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 2000 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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 …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

730 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