Solved

Filtering based upon template field value

Posted on 2010-09-20
3
369 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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