I have a about 6 or 7 text boxes which needs to be validated to make sure they are not empty from server side code. So how I usually do this is, check each textbox 1 by 1 to ensure that they are not empty. Are there any other efficient methods to do this? I have searched on SO and have found out that adding all the textboxes to a list and using a for each is a much better method. Are there any other ways that this can be achieved? Thanx a lot in advance :)
Creating a system with web front end and SQL backend (microsoft obviously). I have tried using the asp.netsqlprovider but i can;t as i am only allowed one database on the server, so i then tried to update my current database with the triggers to input the schema into the already existing database.Next step i create my own table with two simple fields of username and password and try and authenticate that way, i can't get that to work either.
I ahve limited permissions on the network as i am a University Student. I really don't know what to do. Never had to create a log on system before and i thought it would be far simpler than this. I ahve used Microsoft's sqlprovider schema before and it worked fine. I have also authenticated via IIS and AD too before. I can't do any of those two in this instance it seems.I need an alternative for logging in users, if needs be in can be crude. I also still need to have some kind of two different views too for logged in users and not logged in users, but that can change if needs must.Don't let me down people, haha. Think this posts in the correct place, i could not find another one i thought could be more relevant.
I have an ObjectDataSource that I want to perform updates using a business entity i.e. Type="Object"). Since the values for the entity are within a user control, I have stored a reference to the control in Session and in the updating event, set the new instance to the value of the entity from the user contol property (which also pulls values from the form viaother properties of the control):
Protected Sub MasterDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles MasterDataSource.Updating Dim entity As New Login() Dim accountControl As AccountInfo = TryCast(Session("AccountCtrl"), AccountInfo) entity = accountControl.Entity e.InputParameters.Add("entity", entity) End Sub
My question is, how can I get the update method to pass this entity to the update method in my BLL class? It seems the Update method requires an ID or reference to the original object to use in determining whether any changes have taken place, but I don't really want to do this. In other words, I just want to use the Update event on my ObjectDataSource to pass my entity to the method ("Update") I set as a property and then let this business method handle the update of the data. Shown below, is the BLL update method I want to call:
Public Overloads Function Update(ByVal entity As Login) If entity Is Nothing Then Throw New ArgumentNullException("entity") End If MyBase.Update("UpdateLogin", entity.Username, entity.Password, entity.FirstName, entity.LastName, entity.Role, entity.Region, _ entity.Email, entity.Title, entity.TierID, entity.Street, entity.City, entity.State, entity.Zip, entity.Mobile, entity.Phone, entity.Fax) End Function
When I try to call this as it stands now, I get an error: ObjectDataSource 'MasterDataSource' could not find a non-generic method 'Update' that has parameters: ID, entity. Previously, I'd set up a long list of parameters of basic data types (string, int, boolean), but this is rather cumbersome and I was hoping to use an entity for this (FYI, I also got the same type of error when I tried this approach, but with the ID as the last parameter in the list). Perhaps what I'm doing here is atypical to how the ODS is normally used?? Has anyone done something like this successfully?
i have two sqldatasource controls. one i use to display data in textbox's ,filter'd by a select parameter in page behind code. Once checked, i want to copy this data to the other datasource ,by selecting checkbox.Then display this data in detailsview control.
At present the two datasource controls declared , render data to the page simultaneously during pageload. I want to first check data in textbox's from first source, before second datasource is rendered to screen. note, both are filtered by a page variable. i wish to leave the textbox datasource control in situ, as other controls and code depend on it.The other detailsview datasource is my problem?
I have a Public Sub listed in a class file that I am using to store Select, Update,etc...methods for an Object Datasource. When I attempt to configure the datasource, the Class appears as a business object, but the sub within the class is not available for method selection. (It does not appear in drop down list in wizard.)
The sub exists, so where is a good place for me to start looking for a fix? I have part of the class file listed below:
My Business Logic Layer has AddItem method that add's to Items table in db along with an entry in Balance table.AddItem method uses two TableAdapters Items & Balance. Both these have corresponding Business Objects as Item and Balance.
Here is the AddItem method :
ASPX Page with DetailsView & ObjectDataSource
Now executing this page generates error as
ObjectDataSource 'ObjectDataSource2' could not find a non-generic method 'AddItem' that has parameters: _item, _balance, ItemName, GroupId, CategoryId, AuId, Rate, TotalStrScale, OffsStrScale, OffsAE [code]...
I right click on a TableAdapter, select Add Query, select using QueryBuilder, then select a field to filter upon, and add Filter as =@BookStem. Automatically the QueryBuilder adds the WHERE clause to my new query:HERE (BookStem = '@BookStem')When I press OK, I get "BookStem in expression is not part of the query". And filtering doesn't work.
I'm having a question about an update method using SQL To Entities. I'm sending an object to the class and i'm updating him sucefully, but i need to specify each property of object instead of update in once. For example
In this case, i'm updating name, age and country sucefully but i want to use instead of update each property one-by-one, something like this:
So, the C = New should fill the C with all New values on properties, but this isn't work. To update an object, i've to update each property individual or can i update all in one like C = New?
Out of this 10 rows 3 Rows have their RowState as Added, 2 rows as Modified, and 4 as Deleted.
Now i want to use Datadapter's InsertCommand, UpdateCommand and DeleteCommand
Is it possible to update datatable's changes to Database with Single DataAdpater.Update(DataTable) Call.
Means i will call DataAdapter.Update(DataTable) method only once and with this all new added rows should be inserted in database, modified rows should be updated and deleted rows should be deleted from Database.
I am using 3 updatepanels and each one of them having the formviews in each....
updatepanel1 updatepanel2 fromview 1 [code]...
the problem is the child triggers are not recognising these buttons because its inside a fromview..but on each button click everyting in two update panels are getting postback and doing sql calls...which makes updatepanels useless other than avoiding fullpostback.. how to set a childtriggger for buttons inside a formview of update panel...
all updatepanels are set to ChildrenAsTriggers="true" UpdateMode="Conditional"
How and where can I get the returnvalue from my "DeleteGuestById" method to show the right error message to my user?
I have this:
Protected Sub gvGuestlist_OnRowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles gvGuestlist.RowCommand If e.CommandName = "DeleteGuest" Then Dim index As Integer = Convert.ToInt32(e.CommandArgument) Dim data As DataKey = gvGuestlist.DataKeys(index) Dim GuestId As Integer = data.Values("id") odsGuestlist.DeleteParameters.Clear() odsGuestlist.DeleteParameters.Add("id", GuestId) odsGuestlist.Delete() End If End Sub
In my BLL:
<System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, False)> Public Function DeleteGuestById(ByVal ID As Integer) As Integer Dim returnval As Integer GuestlistAdapter.DeleteGuestById(ID, returnval) Return returnval End Function
I think I have to be in the ObjectDatasources' "OnDeleted" method but I have no what code to place there.
I have a dataset where I would like to upper all string fileds and when done check each field for a value. The other way i thought to do it is to do an upper of each string when I do the conditional check. I would like to know what is quicker upper of the values in the dataset or upper in the conditional statement? Knowing the dataset will contain a max of 10.000 rows and there are multiple conditional statements in the complete process.
HDSK_AUTO HDSK_ID HDSK_CASEDESC 1 TC1 pc spoil 2 TC2 problem Action table: ACT_AUTO ACT_HDSK_ID ACT_DATE ACT_TIMEIN ACT_TIMEOUT ACT_ACTIONS ACT_STATUS [code]...
How do I go about doing this in SQL? I need to return 3 columns: ID, the stuff combined into a single field, and the latest status of each ID. (by latest I mean the most recent entered record's ACT_STATUS. this could be based on the ACT_AUTO I think, which is the auto-increment number)
Which worked fine but with one problem... apparently selectcount method is ignoring filter parameter and is returning the full set of data. Surfing the net I found that select parameters when used are also taken by seleccount method... the problem is that when I used:
Inmediately, I received the error : ObjectDataSource 'odsContrato' could not find a non-generic method 'GetContractsPaged' that has parameters: emprnume, maximumRows, startRowIndex.
So I decided to modify my stored procedure to receive an additional parameter and modify my class to reflect the change but when trying to use it I kept on receiving the same error I showed above in bold.
I have an SQLSiteMapProvider that needs a unique URL and have not got the smarts to work out how to get the provider to do the work so for now I thought I would just add the data to the DB then edit the URL with the ID. I can't do this on the first insert as I do not know the ID as it is an auto generated Primary Key
I tried to us the PostBackURL to go to a 2nd Page that got the New ID and added it to the end of the already known URL "Page.aspx?ID=" but apparently you can't do that as I found out (This would have been a masive hack to the problem I know but it would have got around it issue of for now)
this is how I guessed it would work
Insert Data with URL "Page.aspx?ID=" and more data.... Then Get New ID and update URL to have the ID on the end ie: Page.aspx?ID=99