DataSource Controls :: Re: 3.5 SP1 / VS2008 SP1 - ? Breaking Change?
Apr 1, 2010
I had the same problem and used this posted to fix some of it.Now I had it on
SqlDataSource1.SelectParameters.Add("dateListedSince", TypeCode.DateTime, Date.Now.AddDays(-30))
any ideas how to fix that?
View 2 Replies
Similar Messages:
Oct 25, 2010
Currently, I have long script which does major processing and then puts data into temp table.
Finally I read data from this temp table to show on the chart, based on user's selection of parameter. So I can divide my query into two parts and while I am researching this,
Is it possible to do processing in one Datasource and read table from second datasource?Is it even possible?
If not, what is recommended method for this (breaking large processing into small one)?
View 2 Replies
Jan 20, 2011
I have an app I am transitioning to MVC3 to see what the upgrade path is essentially. I've hit a snag. I believe I've run into a change that may be due to the changes for Dependency Injection in action filter attributes, but I have been unable to track down the cause, and the "correct" solution.This project uses StructureMap and NHibernate. The NHibernate session is started at the beginning of each request, and ends at the end of each request, thanks to a small module. This is just to give an idea of the stack involved...o I have a few custom Authorize attributes (Inheriting from AuthorizeAttribute) that perform some more complicated authorization logic for specific actions that they decorate. Part of their functionality involves using two repositories which they must either (a) have injected, or (b) get from the StructureMap ObjectFactory themselves. In MVC2 I was using option b, so that the CONSTRUCTOR of the attribute looked like this:
[Code]....
This worked fine, as in MVC2 the constructor was called each time the attribute was evaluated. This BREAKS in MVC3, where it would appear that this is no longer the case. Due to this apparent change, the FIRST time this attribute is evaluated, it runs fine, but each subsequent time, any calls in the repositories fails because it claims the NHibernate Session object hasn't been started! The reason being, as far as I can tell, that the CustomAuthorizeAttribute is created once, and then held in whatever state it exists in at that point for the lifetime of the application... Which means that the dependencies inside of it (Which SHOULD go out of scope at the end of each request, and be reinstantiated / fetched at the beginning of subsequent requests), are instead persisting with it becoming stale after the first evaluation.After banging my head against the desk for a few hours, I realized that simply moving these calls to the ObjectFactory into the AutorizeCore method made everything work again.Now, all of this was of course, a hack, because there wasn't a good easy to do real dependency injection into attributes in MVC2. I hear that is changed in MVC3, and I am wondering if this behavior is in response this change, and if so, what do I need to do to make this work?
View 3 Replies
Mar 18, 2010
I have a problem. (this a simplfied example)
In Entity framework I have a class which is effectively
fooEntity
{
public Guid Id {get; set;}
and a collection of fooChildEntity
}
a fooChildEntity is again an entityframework class
fooChildEntity
{
public Guid kidId {get; set;}
}
Now I also have a pair of business layer classes foo and fooChild
foo
{
public Guid Id {get; set;}
ilist<fooChild> Children {get;set;}
}
fooChild
{
public Guid kidId {get; set;}
}
My aim is to write a linq to entites that will allow me to convert the entity foo and children into the business foo and children without breaking deferred execution ( I will be adding filters to reduce the recordset at a higher coding level in the business layer)
doing something like
this.context.fooEntity
.include(fooChildEntity)
.Select( fe => new foo { Id=fe.Id ,
fe.foreach(fec => Children.add( new fooChild { kidId = fec.kidId}))})
.AsIQueryable()
is plainly rubbish and would never compile - it is however an indication of the direction I was thinking .
Even if I got a foreach to work like that or similar it would break deferred execution
At this point there are around 300,000 foo entities which I will eventualy filter to 5 or 6 foo's - this is why deferred execution is needed.
View 1 Replies
Apr 22, 2010
I have just upgraded a large project to MVC 2 (50+ controllers) and whilst the project builds fine I am having issues in several places because it looks like the way the Controller.UpdateModel method handles emtpy strings has changed.
In MVC 1 it set the associated property to an empty string but in MVC2 it's setting it to null.
View 2 Replies
Apr 22, 2010
I have just upgraded a project from MVC 1 to 2 and I have come across an issue with fields updated via UpdateModel which contain an emtpy string.
In MVC 1 the associated property would be set to String.Emtpy or "", but in MVC 2 it's set to null. This is causing me all kinds of problems
View 1 Replies
Nov 18, 2010
In the past I deployed my apps using IIS running on IE6 and VS2008. When deploying using IIS a port number was attached to the localhost something like: [URL] then after deployment the website could be accessed from any other machine using the url. Recently VS2008, IIS and IE8 was installed. But now when I use IIS to deploy the app no port number is attached to the localhost which means that the app cannot be accessed
by another machine.
This is because of the default setting being installed. There is a way to go into properties and change the default settings to make IIS deploy the app with the port number. How you change the default setting to make IIS deploy the app with the port number attached again so the app can be accessed by another machine using the apps url?
View 1 Replies
May 20, 2010
It's breaking at spot below in RowUpdating Event with the error msg "Index was out of range. Must be non-negative and less than the size of the collection"
txtAddress = CType(GridView1.Rows(e.RowIndex).FindControl("txtAddress"), TextBox).Text
Here's my code:
ASP
<form id="form1" runat="server">
<asp:GridView id="GridView1" runat="server" CssClass="Grid" DataKeyNames="ID"
AllowPaging="false"
OnRowEditing = "GridView1_RowEditing" OnRowDeleting = "GridView1_RowDelete"
OnRowUpdating = "GridView1_RowUpdating"
AutoGenerateColumns="False"
EnableViewState="false" ShowFooter="true">
<FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle>
<HeaderStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle>
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<%#Eval("ID")%>
</ItemTemplate>
<FooterTemplate>
<asp:Button id="btnAdd" Runat="server" Text="Add New" CommandName="Insert"></asp:Button>
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="true" EditText="Edit" HeaderText="Edit" CausesValidation="false"/>
<asp:CommandField ShowDeleteButton="true" EditText="Delete" HeaderText="Delete />
<asp:TemplateField HeaderText="mlsnum">
<EditItemTemplate>
<asp:TextBox ID="txtMls" runat="server" Text='<%# Eval("mlsnum") %>'/>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("mlsnum")%>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtMLS" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqMLS"
runat="server" ControlToValidate="txtMLS"
Display="Dynamic"
ErrorMessage="You must enter an MLS #.">
* </asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<EditItemTemplate>
<asp:TextBox ID="txtAddress" runat="server" Text='<%# Eval("Address") %>'/>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("Address")%>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqAddress"
runat="server" ControlToValidate="txtAddress"
Display="Dynamic"
ErrorMessage="Please enter an address.">
* </asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Subdivision">
<EditItemTemplate>
<asp:TextBox ID="txtSubdivision" runat="server" Text='<%# Eval("subdivision") %>'/>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("Subdivision")%>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtSubdivision" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqSubdivision"
runat="server" ControlToValidate="txtSubdivision"
Display="Dynamic"
ErrorMessage="Please enter a Subdivision.">
* </asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Price">
<EditItemTemplate>
<asp:TextBox ID="txtPrice" runat="server" Text='<%# Bind("Price") %>'/>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("Price")%>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtPrice" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqPrice"
runat="server" ControlToValidate="txtPrice"
Display="Dynamic"
ErrorMessage="Please enter an Price.">
* </asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Agent">
<ItemTemplate>
<%#Eval("Agent")%>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtAgent" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqAgent"
runat="server" ControlToValidate="txtAgent"
Display="Dynamic"
ErrorMessage="Please enter an Agent.">
* </asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Comment">
<EditItemTemplate>
<asp:TextBox ID="txtComment" runat="server" Text='<%# Eval("Comment") %>'/>
</EditItemTemplate>
<ItemTemplate>
<%#Eval("Comment")%>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtComment" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqComment"
runat="server" ControlToValidate="txtComment"
Display="Dynamic"
ErrorMessage="Please enter a Comment.">
* </asp:RequiredFieldValidator>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PhotoAd">
<EditItemTemplate>
<asp:checkbox ID="chkPhotoAd" runat="server" Checked=true/>
</EditItemTemplate>
<ItemTemplate>
<asp:checkbox id="chkPhotoAd" runat="server" Enabled="true" />
</ItemTemplate>
<FooterTemplate>
<asp:CheckBox ID="chkAddPhotoAd" runat="server" Enabled="true" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="LineAd">
<EditItemTemplate>
<asp:checkbox ID="chkLineAd" runat="server" Checked=true/>
</EditItemTemplate>
<ItemTemplate>
<asp:checkbox id="chkLineAd" runat="server" Enabled="true" />
</ItemTemplate>
<FooterTemplate>
<asp:CheckBox ID="chkAddLineAd" runat="server" Enabled="true" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="# of Balloons">
<EditItemTemplate>
<asp:TextBox ID="txtNumBalloons" runat="server" Text='<%# Eval("NumBalloons") %>'/>
</EditItemTemplate>
<ItemTemplate>
<%# Eval("NumBalloons")%>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="intNumBalloons" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Try
BindData()
Catch ex As Exception
'Error Handler
lblError.Visible = True
lblError.Text = Err.Description()
'lblError.Text = Err.Number
End Try
End If
End Sub
Sub BindData()
Dim ds As New DataSet
Dim objDS = New DataSet
Dim cmd As SqlCommand
Dim dataAdapter As New SqlDataAdapter
strSqlConnection = ConfigurationManager.AppSettings("ConnectionString")
sqlConn = New SqlConnection(strSqlConnection)
strSqlStatement = "select * from tblAdSignup"
cmd = New SqlCommand(strSqlStatement, sqlConn)
dataAdapter.SelectCommand = cmd
dataAdapter.Fill(ds)
objDS.DataSetName = "ds"
GridView1.DataSource = ds
GridView1.DataBind()
End Sub
Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs)
GridView1.ShowFooter = False
GridView1.EditIndex = e.NewEditIndex
BindData()
End Sub
Protected Sub GridView1_RowCancel(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
GridView1.ShowFooter = True
GridView1.EditIndex = -1
BindData()
End Sub
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs)
'Try
'BindData()
'Dim eRow As Int16 = e.RowIndex
'Dim id2 As Integer
ID = GridView1.DataKeys(e.RowIndex).Value
'ID2 = GridView1.DataKeys(1).Value
Dim txtAddress, txtAddress2 As String
'Dim test As Integer
'test = GridView1.Rows(0).Cells.Count
'Dim strAddress As String = DirectCast(GridView1.Rows(e.RowIndex).FindControl("txtAddress"), TextBox).Text
'Dim txtAddress As TextBox
'txtAddress = DirectCast(GridView1.Rows(e.RowIndex).FindControl("txtAddress"), TextBox)
txtAddress = CType(GridView1.Rows(e.RowIndex).FindControl("txtAddress"), TextBox).Text
'txtAddress2 = GridView1.Rows(0).Cells(0).Text
'txtAddress2 = CType(GridView1.SelectedRow.FindControl("txtAddress"), TextBox).Text
'
'Catch ex As Exception
' 'Error Handler
' lblError.Visible = True
' lblError.Text = Err.Description()
' 'lblError.Text = Err.Number
'End Try
End Sub
View 8 Replies
Jan 4, 2010
Let's say I have a table that holds information about books, with a column called bookid as a primary key with auto increment of 1. When I create a couple of records, it assigns 1 to the first row and 2 to the second row for the bookid column. If I delete the second row and enter another row, even though table now only has 2 records, the primary key column says 1 and 3 for their bookids. Is it possible to change back the bookid of the second record from 3 to 2 or is it just server assigned and can't be changed.
View 9 Replies
Apr 8, 2010
By default the OldValuesParameterFormatString sets to original_{0}.I would like it to set to {0}.Is this possible?
View 4 Replies
Oct 11, 2010
i have an SQLdatasource in my page
i was trying to modify it as:
SQL.SelectCommand = "Select * from " + TXT_Tabella.Text;
because i want update dinamically my sql server tables but ,every time i am going to sort, or change page the selectCommand returns as before!
viewState is true! how can i have an SQLdatasource dinamyc by tableName? and how this problem occurs?
View 3 Replies
Jan 26, 2010
I am working on sql server 2000.I have only one instance running on SQL SERVER 2000.I have the instance name as 'ashvinDIT0934/sys07DIT' registered somehow.But i need to have it simply as 'mycompanyname' (no changes but as 'mycompanyname'). how i could change it and have the instance name changed.The instance name that i have given above i.e (ashvinDIT0934/sys07DIT) when inserted into the connectionstring does not work.It says as invalid escape sequence.So hence i need to have it as 'mycompanyname'
View 3 Replies
Apr 15, 2010
this is my sample script
[Code]....
after execute this script which returns a column name "XML_F52E2B61-18A1...." can I change this column name?like this
select EMPNO AS EmployeeName -- we can use AS to change column name
from EMPLOYEE
View 1 Replies
Jan 3, 2010
There's a dataset that i have and it has a "UpdatedDate" column in it.In the sql side, i don't want to make any change to the date format.
The date format should be "dd-MMM-yyyy".I want the date in the dataset ito appear in this format.
View 2 Replies
Jun 11, 2010
I have problem with retrieve value from Microsoft Access (MDB)..
I want get a value from Database and change it and Store it (Updated Value) again..
For example, I have number 2 in my DB, i want get it and Add 1 to it and store number 3 (Updated number 2) again..
I use SELECT Command but i can`t store values to a place for change them..
View 2 Replies
May 5, 2010
I want to know about Change Data Capture(CDC) benefits in SQl Server?Especially on Data Base Volume?
View 1 Replies
Feb 27, 2010
I want to call my business object class in which I have written my logic when any database status field change, what is the best way we can do, I want notification facility also.
I can do this window service. But there is any best way to acheive this like Notification and call my business object.
View 1 Replies
Apr 28, 2010
I would change the filterexpression depending to the choice of some DropDownList but, i've tryed with ObjectDataSource_Filtering event but it seems that non reevaluate the filter.is it the right event?i've to do any other operations after changing the filterexpression?
View 1 Replies
May 7, 2010
I am using SqlDataSource control to query my data via store procedure. Based on which option the user picked from the RadioButtonList control, I want to dynamically at run time to choose which store procedure gets executed. How do I do this? I am already using Query String for my parapmeters. I can could use this for the store procedure as well. The problem is, how do I get the SelectCommand to pick the store procedure name from the parameter passed in the URL?
View 7 Replies
May 7, 2010
[Code]....
modifying WHERE Clause and change to RegEx?
View 1 Replies
May 14, 2010
I have one table in database in which millions or records exest already. I can't change the structure of table. And i have to create 4 store procedure each of them will fetch 100 records from this table. And they will keep going on. But condition is that they should not fetch same row. how can all store procedure fetch uniqe data from table.
View 4 Replies
Jul 8, 2010
I am in process of developing a registration website for a convention for work. When people register they can choose an activity to do on the convention, however some activites have a maxmium number of people. In my activity table in the database i have the following fields;
RecordID, Name, Limit, Booked, Status
So the record ID is automatic, the name is the name of the activity, limit is the maximum number that activity can hold (20), booked will have the value of the number registered for the activity and status is either open or closed. If closed the activity does not show up for the people to register.
I am not sure how to have an UPDATE query running when the person registers it UPDATES the activity database with the value in BOOKED + 1 and once BOOKED EQUALS LIMIT the status changes to Closed.
View 2 Replies
Aug 18, 2010
Is it possible to change the select, insert and update stored procedure of an SqlDataSource at run time. I don't mean to change the definition of the stored procedure, but I mean to change the assignment, i.e. To change the select stored procedure from "selectSP1" to "selectSP2" at run time. Is it possible?
View 4 Replies
May 29, 2010
I was reading about "Change Data Capture" functionality in SQL Server 2008. It sounds awesome. My implementation of it would be in a website environment where ASP.NET pages use SQLDatasources to do inserts, updates and deletes. When enabling "Change Data Capture" can you store additional information supplied from the website like a UserID, SessionID, UserRole etc so you can identify who did the insert, update or delete? [URL]
View 1 Replies
Mar 9, 2010
I have a web content page that contains a ListView with two identical dropdownlists, one in the InsertItemTemplate and the other in the EditItemTemplate. I populate each from the same datasource. The listview is wrapped in an UpdatePanel.Any template change requires from 3-5 seconds to render which is not acceptable. The datasource can potentially change at any time thus limiting my options.
View 3 Replies