DataSource Controls :: Date Selection With ControlParameter

Mar 26, 2010

I have a gridview connected to sqlDS and a dropdown Dropdown contains a selection Last 30 days, 60, 90,180 etc... How to write a Where Statement that reflects this? If I want to view the last 60 days of records

WHERE RecordDate >= TodaysDate - 60 days, but as a parameter
WHERE RecordDate >= TodaysDate - @SelectedValue days

Is this a clear explanation?

View 2 Replies


Similar Messages:

DataSource Controls :: Add More Than One Default Value For ControlParameter?

Jan 4, 2011

Some of you might know that I am currently working on a simple blog (thread with full details here). There is a slight problem however ! After achieving the post filtering, the blog doesn't show any posts, unless; I click on of the categories. I was hoping that the blog would show ALL posts at first, and THEN if a user clicks a Category, the filtering would occur. So I went over the code again, and there was this:

[Code]....

The DefaultValue="0" caught my eye, so I changed the number to "1" and I got all the posts in the [ General ] category, I tried "2" and I got the posts from the [ Programming ] category ..etc So I was thinking how I'd go about solving this problem, because (initially) I want the posts from ALL categories to show. Is it possible to add more than one defaultValue ? for example: DefaultValue = "1,2,3"

I have tried the above and it gave me errors, so obviously it doesn't work that way, but is there another way of adding more default values ? Or could you think of a different way to make all the posts show ?

View 11 Replies

DataSource Controls :: Could Not Find Control 'txtSurname' In ControlParameter 'Surname'?

Feb 21, 2011

I am trying to add a textbox search to a gridView. However I am recieving the below error

View 3 Replies

DataSource Controls :: Declaritively Set Value Of Sqldatasource Controlparameter Propertyname To An Expression?

Feb 4, 2011

I have this code in an .aspx file, within a sqldatasource control.

<asp:controlParameter
Name="WH"
ControlID="rblWH"
DefaultValue="DL"
Type="String"
Size="2"

Which currently uses a 2 character code from a radio button list as its value. It is used as a parameter for a stored procedure. Somewhere else on the page I have a combobox called cbTripPick with that 2 character code embedded within its text property. I wish to use that 2 character substring as the control parameter instead of the above. Can I do something like this ?

<asp:controlParameter
Name="WH"
ControlID="cbTripPick"
PropertyName = "some function or expression or eval that will give me the 2 char. value from the cbTripPick control"
DefaultValue="DL"
Type="String"
Size="2" />

Is it possible to declaratively set the propertyname to some dynamic expression which will get me what I want? Or should this all be done programmatically?

View 4 Replies

Forms Data Controls :: Date Selection Is Not Displaying In Textbox Of FormView?

May 3, 2010

Here my question is very simple. That what I want to do is to select a date using asp.net calender control and insert into textbox. Both the controls are in the InsertItemTemplate of the FormView.

1. Page1.aspx has a textbox and an image for calender.

2. Calendar.aspx is to select any date and with the help of session it should go back to its parent page in the text box and dispose itself.

Achievement:1. From Page1.aspx when i click Calender image, perfectly a new page Calendar.aspx opens.

2. On Calendar.aspx page, date selection is also OK.

3. Using Session, the date is perfectly transfering to next page.

Problem: 1. When I select date from Calendar.aspx it is not transfering back to Page1
in textbox.

2. Secondly when I select date from Calendar.aspx it is not disposing itself after date selection.

View 43 Replies

DataSource Controls :: Format A Date Field In DataView.RowFilter To Consider Date Only - Not Time

Jan 27, 2010

I am filtering dataview using my Date Column but the result is not proper because the Field value also stores time, so I want to convert this Date Field to only Date during Filter. How can I achieve this? Here is my code. And the actual value I am getting in the Dataset Field "CreationDate" is a DateTime field which is like

2010-01-21 14:35:25.203
2010-01-22 12:55:18.033
2010-01-26 12:10:06.990

But I only want to neglet time value and want to compare Date only.

[Code]....

View 5 Replies

DataSource Controls :: : Update A Date Field To The System Date But It's Not Working?

Jan 27, 2010

I'm trying to update a date field to the system date but it's not working. Could someone please help with the syntax?

[Code]....

View 18 Replies

DataSource Controls :: Retrieving And Storing Date Information To Database / Unable To Insert A New Date As Same Format?

Apr 29, 2010

I have some issues about retrieveing and storing date information to my database (ms sql server 2005).My data column is a DateTime, and i have set my web.config globalization culture is set to "en-gb"

When i retrieve date from the datebase it appears as dd/MM/yy, that's fine. But i cannot insert a new date as same format?! It will only accept MM/dd/yy or yy/mm/dd.Right now i'm using this code to correct the error:

[Code]....

Is it possible to change the date format on the database or something, so i dont need to use this code?

View 11 Replies

DataSource Controls :: Comparing Max(Date) To Today's Date?

Mar 10, 2010

I've got a stored procedure that get's the max date of the entries in a table.

I would like to compare that date to today's date and if they are the same, display the data.

Here's my terrible attempt at writing the code.

[Code]....

View 7 Replies

DataSource Controls :: How To Add A DropdownList Selection To A SQL Query String

Feb 22, 2010

Trying to Add a Dropdownlist Selection to a Query String. When I use this :

[Code]....

View 5 Replies

DataSource Controls :: Multiple Selection Checkboxlist To Database?

Apr 27, 2010

i need to know how i can save more than 1 of the selected values from a checkboxlist to a database. I tried the following code.

ArrayList test = new ArrayList();
for (int i = 0; i < CheckBoxListMeest.Items.Count; i++)
{

[code]...

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_MeestenEvaluatie_MeestGeAsp". The conflict occurred in database "GIPDatabase", table "dbo.MeestGeAsp", column 'EvMeestID'. The statement has been terminated.

View 3 Replies

Web Forms :: Want To Restrict Future Date Selection?

Apr 27, 2010

I want to restrict future date selection, how can i do it..........?

Is there any regular expression to do this..............?

View 2 Replies

Web Forms :: Selecting Week On Selection Of A Date?

Jan 4, 2011

I need to select complete week on selection of a day in calendar control.

View 1 Replies

ADO.NET :: Convert Selection Of Date Field Into Char (10)?

Mar 22, 2011

Let's say I am pulling data from SQL using a function that returns one field - date. I can see that in my model code for a getter, setter, and other things are set for DateTime. What happens if I go into the function and convert selection of my date field into char(10)?

View 6 Replies

DataSource Controls :: Gridview Change Data Source By Hyperlink Selection?

Apr 11, 2010

i'm working with visual studio 2005 c#

i have in one aspx page a gridView with a few of sqlDataSources ..

and i have in another page ,,, hyperlinks ... and i want that it will select a defrent datasorce each time i click on other link ....

View 3 Replies

AJAX :: CalendarExtender - Calculate Age On Date Selection Using JavaScript?

Apr 30, 2012

I am using AJAX Control Toolkit calendar extendar for allowing my users to select date of birth. I want to calculate age once they select date of birth using JavaScript....

View 1 Replies

Forms Data Controls :: Using Gridview SelectedIndex In ControlParameter?

Mar 1, 2011

I am having a problem with using A Gridview SectedIndex or value in a sql ControlParameter. When I select the row it does what I need it to except it shows that there is no data.

but if I add Default Value of 1 the data shows up, but it needs to read from the Gridview.

[Code]....

I even added sqlDataSource.DataBind() in the SelectedIndexChanged Event to see if that would fix it but - No! I used it with a DropDown and it worked only when I use AutoPostBack = true of course.

View 3 Replies

AJAX :: Replace Button Event With Date Selection Of Calendar Extender

Feb 12, 2010

I am using the ajax toolkit calendar extender control with the asp.net button for the postback event. the functionality is after selecting the date, clicking on the submit button will call the button event. now I need to obtain the same thing without clicking the button and on the date selection. ie, on selecting or closing the calendar control the postback event has to fire. how too obtain this? calendar and the button are placed in the user control.

View 8 Replies

Forms Data Controls :: Getting Error / Could Not Find Control 'GridView1' In ControlParameter 'ID'

Jul 2, 2010

I am working on a project and I need to use Master/Details view, the problem is everything works fine except when I place the Master (gridview) and Details(FromView) in different content holder.

The error I get is:

Could not find control 'GridView1' in ControlParameter 'ID'.

Description:

An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find control 'GridView1' in ControlParameter 'ID'.

My code is:

[Code]....

[Code]....

[Code]....

[Code]....

View 2 Replies

Forms Data Controls :: Bind ObjectDataSource ControlParameter To EditItemTemplate Textbox

Mar 11, 2010

I have an ObjectDataSource with a number of parameters. These parameters are binded in my FormView EditItemTemplate and the ItemTemplate. My Stored Procedure column names in my ItemTemplate are different to the Bind properties used in the EditItemTemplate. This is obviously throwing an exception when I update a record.

Instead of using Bind("Columne Name") in my EditItemTemplate how do I use a ControlParameter to reference a TextBox in the EditItemTemplate?

I may be wrong but I'm trying to use the PropertyName=Controls but i do not know how to reference the Textbox in the EditItemTemplate.

View 9 Replies

Forms Data Controls :: Could Not Find Control 'ddlSongs' In ControlParameter 'AlbumID'?

Jan 24, 2011

i'm using Relational Tables and during Edit, my Drop Down list is a lookup column from the Master table, but when i try to edit it works and shows the records the only problem is that when i udpate, i get the error (Can't find control DDLSongs (my drop down control) in @AlbumID Parameter) below is the code for ref.

<asp:GridView
ID="grdSongs"
runat="server"
DataSourceID="srcSongs"
DataKeyNames="SongId"
AutoGenerateColumns="false"

[Code]....

View 5 Replies

Forms Data Controls :: Could Not Find Control 'SelectedAlbum' In ControlParameter 'AlbumID'

Dec 12, 2010

i have two tables (Albums,Photos).befor i want insert a record in a Photo table i must select name of album so i create a user control that have a dropdownlist and a datasource(Albums table) until when i select a name of album put AlbumID in a Property(SelectedValue) when i use this user control in details view in edittemplate i have an error

--->error could not find control 'SelectedAlbum' in ControlParameter 'AlbumID' my code id:

public partial class Admin_SelectedAlbum : System.Web.UI.UserControl
{
public string [COLOR="Red"]SelectedValue[/COLOR] {
get { return DropDownList1.SelectedValue; }
}
protected void Page_Load(object sender, EventArgs e)
{.........

how does AlbumID (photo table) set with value of property(SelectedValue) of Usercontrol?

View 2 Replies

Forms Data Controls :: Prepare Dropdownlist Selectedvalue To Be A ControlParameter Source For ObjectDataSource?

Apr 12, 2010

I have following in many controls:

<asp:ControlParameter Name="SvcCluster_Id" ControlID="frmConfigEdit$ddlCluster" PropertyName="SelectedValue" />

Everything was good before I bumped into the problem when declarative binding (SelectedValue='<# Bind("SvcCluster_Id") >') produced the error, because value has not been found in the list. So i moved binding to the code:

protected void frmConfigEdit_DataBound(Object sender, System.EventArgs e)
{
if (frmConfigEdit.CurrentMode == FormViewMode.Edit)
{
var svcCluster_id = DataBinder.Eval(frmConfigEdit.DataItem, "SvcCluster_id");
var ddlCluster = (DropDownList)frmConfigEdit.FindControl("ddlCluster");
if (svcCluster_id != null && ddlCluster.Items.FindByValue(svcCluster_id.ToString()) != null)
{
ddlCluster.SelectedValue = svcCluster_id.ToString();
}
}
}

But now seems like this happens later than ObjectDataSource tries to access frmConfigEdit$ddlCluster...

How to manage this?

I wouldn't like to move everything to the code (I mean creating Control parameters, etc)

p.s. Oops, actually it works ok for DataBound event! Sorry.

View 2 Replies

Forms Data Controls :: Gridview Updating - Could Not Find Control 'tbDescriptiontext' In ControlParameter 'descriptiontext'?

Sep 21, 2010

I have this code:

<asp:GridView ShowFooter="true" DataSourceID="odsRooms" Width="700" DataKeyNames="id,locationid" ID="gvRooms" GridLines="None" PageSize="10" runat="server" AllowSorting="true" AllowPaging="True" CellSpacing="4" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Bottom" >
<ItemTemplate>
<%# Eval("roomname")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tbRoomname" MaxLength="20" Text='<%# Eval("roomname")%>' runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Bottom">
<ItemTemplate>
<%# Eval("sqmeters")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tbSqmeters" MaxLength="6" Width="60" Text='<%# Eval("sqmeters")%>' runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<%# Eval("persreception")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tbPersreception" MaxLength="6" Width="60" Text='<%# Eval("persreception")%>' runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Bottom" >
<ItemTemplate>
<%# Eval("persdiner")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tbPersdiner" Text='<%# Eval("persdiner")%>' MaxLength="6" Width="60" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Bottom" >
<ItemTemplate>
<%# Eval("persparty")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tbPersparty" Text='<%# Eval("persparty")%>' MaxLength="6" Width="60" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Bottom" >
<ItemTemplate>
<%# Eval("descriptiontext")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="tbDescriptiontext" Text='<%# Eval("descriptiontext")%>' TextMode="MultiLine" Rows="2" Columns="28" runat="server" />
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowDeleteButton="true" DeleteText="Delete" ShowEditButton="true" EditText="Edit" CancelText="Cancel" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsRooms" InsertMethod="InsertRoom" DeleteMethod="DeleteRoom" UpdateMethod="UpdateRoom" runat="server" SelectMethod="GetLocationRoomsPagedSorted" SelectCountMethod="GetLocationRoomsCount" SortParameterName="sortExpression"
TypeName="locationsBLL" EnablePaging="true">
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:ControlParameter ControlID="tbRoomname" PropertyName="Text" Name="roomname" Type="String" />
<asp:ControlParameter ControlID="tbSqmeters" PropertyName="Text" Name="sqmeters" Type="String" />
<asp:ControlParameter ControlID="tbPersreception" PropertyName="Text" Name="persreception" Type="String" />
<asp:ControlParameter ControlID="tbPersdiner" PropertyName="Text" Name="persdiner" Type="String" />
<asp:ControlParameter ControlID="tbPersparty" PropertyName="Text" Name="persparty" Type="String" />
<asp:ControlParameter ControlID="tbDescriptiontext" PropertyName="Text" Name="descriptiontext" Type="String" />
<asp:Parameter Name="id" Type="Int32" />
</UpdateParameters>
</asp:ObjectDataSource>

And get this error when I click 'Edit' and then 'Update':

Server Error in '/' Application. Could not find control 'tbDescriptiontext' in ControlParameter 'descriptiontext'.Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Could not find control 'tbDescriptiontext' in ControlParameter 'descriptiontext'.

Source Error:

[Code]....

Stack Trace:

[Code]....

[InvalidOperationException: Could not find control 'tbDescriptiontext' in ControlParameter 'descriptiontext'.]
System.Web.UI.WebControls.ControlParameter.Evaluate(HttpContext context, Control control) +2961386
System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +152
System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +113
System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +47
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +1204
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +3636597
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1336
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +641
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +164
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +52
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3691

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

View 1 Replies

DataSource Controls :: How To Get Date From Dataset.xsd

Apr 6, 2010

I have a problem, I need to get a date from an SQL database using a dataset.xsd.

To do that, I have created a query in the TableAdapter called GetDataByFecha:

SELECT fecha
FROM T_Tickets
WHERE(fecha = @fecha)

in C# I do this:

DateTime T_fecha;

T_fecha = Convert.ToDateTime(ticketsAdapter.GetDataByFecha(fechaTicket));
but, when I compile it I get this error:
cannot convert a 'T_TicketsDataTable' object to 'System.IConvertible' type.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved