Solved

Filtering based upon template field value

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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 …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now