DataSource Controls :: Passing Parameters To ObjectDataSource

Aug 9, 2010

I followd Brian Orrell LINQ tutorial for paging/sorting and created a gridview bound to an ObjectDataSource through a method call which gets data from adatabase. My form includes two buttons with a textbox next to each one of them. I need to be able to populatte th egridview depending on the button that was pressed, I cannot figure out how signal my method which button was pressed.
[Code]....
[URL]

View 1 Replies


Similar Messages:

DataSource Controls :: ObjectDataSource Update With Parameters?

Feb 16, 2010

http://msdn.microsoft.com/en-us/library/ms178538(VS.80).aspx ?I tried and got error as below, at clicking Update button in detailView

'/CaseExamples' 응용 프로그램에 서버 오류가 있습니다. ==> Server error in application program
ObjectDataSource 'EmployeeDetailsObjectDataSource'에서 매개 변수 (LastName, FirstName, Address, City, Region, PostalCode, original_FirstName, original_LastName, original_Address, original_City, original_Region, original_PostalCode, original_EmployeeID)를 사용하는
네릭이 아닌 UpdateEmployee' 메서드를 찾을 수 없습니다.

View 3 Replies

DataSource Controls :: Objectdatasource With Unpredictable Number Of Input Parameters?

Dec 10, 2010

I'm trying to use an objectdatasource and populate it with a query that has "or" in its where statement. eg: select * from customers where customer_id = "34" or "35" or "36"The problem is... I don't know ahead of time how many of these "or" conditions there will be - the user can choose as many or as few as they want. It seems that if I want to use an objectdatasource tied to a tableadpater I'm forced to know the number of parameters ahead of time so that I can build the objectdatasource's input parameters e.inputparameters.add doesn't work, because the key (in this case "id") is the same for each parameter because the where statment has "or"s....

View 7 Replies

DataSource Controls :: Passing Object To ObjectDataSource.SelectParameters Collection

Mar 30, 2010

I'm trying to use an ObjectDataSource's SelectMethod() to retrieve a result set from a sql server database to populate a data table with various stored procs that have any given number of parameters. My approach is to pass an object which contains the stored proc name and information about its parameters into the SelectMethod(). My issue is that I don't know how to actually set the default value. Here is the code I have so far:

ObjectDataSource1.DataObjectTypeName = "WebApplication1.Children";
ObjectDataSource1.TypeName = "WebApplication1.Children";
ObjectDataSource1.SelectMethod = "Select";

Parameter odsParameter = new Parameter() { Name = "storedProc", Type = TypeCode.Object };

// How do you set the default value to reference an object?

ObjectDataSource1.SelectParameters.Add(odsParameter);

namespace WebApplication1
{
public class Children
{
public DataTable Select(object storedProc)
{
// do stuff here and get db values.
}
}
}

The default value of a Parameter object is a string type. Does anyone know how to set the default value with an object or how I can pass an object into the SelectMethod?

View 2 Replies

DataSource Controls :: Pass Parameters To The Selectmethod Property Of The Objectdatasource Control

Mar 27, 2011

how to pass parameters to the selectmethod property of the objectdatasource control.

View 1 Replies

DataSource Controls :: Parameters Seems To Not To Be Passing Parameter To The Control

May 5, 2010

i have the following code

[Code]....

I have debugged the session and the value there is valid , but when i redirect to the page[Code]....

The Parameters seems to not to be passing parameter to the control

View 2 Replies

DataSource Controls :: Passing Results / Parameters In LINQ

Jan 20, 2010

im new to linq and im having lots of trouble creating complex queries.. My problem mainly is that i am using Linq as a BLL.

i created a dbml (with namespace called DAL) file with 2 tables with a one to many relation. Pop and City. There is a forgien key in pop that points to a city. I also created a class called Pop that inhertis DAL.Pop. Now in my ASPX page, i want to call a function in the Pop class that would retrieve some Pop according to its ID, but i need the city name as well.. Ive been going around this in circles for days. I dont know how to write the Linq syntax and i dont understandd how my function's signature should be like.. I want to recieve a table that i can bind to a Gridview and preferable, specify which coloumns to bind.

View 2 Replies

DataSource Controls :: Passing Parameters To Data Class

Apr 23, 2010

I have an ObjectDataSource3 that I am trying to use to insert data from:

From: Dropdownlist1.selected value To: (CustomerID)
From: Dropdownlist2.selected value To: (ProductCode)
From: txtTitle (Title) To: (Title)
CurrentDate To: DateOpened
The btnAdd event is suppose to calls:
ObjectDataSource3.Insert()

Below is my code for both the page and class. Although my class is expecting parameters, I don't know how to get the parameters to the insert function in my class.

[Code]....
[Code]....

View 2 Replies

DataSource Controls :: Passing Parameters By Selecting Event Handler?

Sep 19, 2010

I'm having an issue coming up with an appropriate code design to implement a search page using linq to sql for my DDL. I think the best way for me to explain where I'm at is describing what I've done in the past, before linq. Lets say we have a basic search page with various user input controls for search options... for simplicity, let's say there are two main ways the user can search.
1. a dropdown filled with account numbers. When that drop down is changed and an account number is selected, a gridview needs to be populated with all the records for that account.
2. the second way is a dropdown for choosing what field you want to search, a textbox for entering what you want to search for, and a button to execute that search. In the past, just using straight ado.net

I would handle each of these two search options separately within the events of the dropdown list and the button, respectively. In selectedIndexChanged for 1, and in the buttonClick event for 2, I would construct my sqlCommand etc., ultimately returning a dataset or datatable which I would then bind to the gridview. The logic was separated by the two different event handlers. Now, fast forward to linq to sql and I have a similar page layout, but I am using the linqdatasource selecting event to build my where conditions. Now the difference is *everything*, all the logic, is now in this one event handler, which search option did the user run? Could I somehow craft an IQueryable <T> within each of the input controls event handlers (like the button click, or selectedIndexChanged of the dropdown) and pass that in to the linqdatasource's selecting event? that way my logic stays logically separated...

further, after this initial search is done and results are bound to a gridview, I have several other dropdown lists that appear for search refinement. I need to keep track of that top level query, and each of the refinements... and again, right now it looks like everything is going into the linqdatasource selecting event and I get the feeling it shouldn't be... using the selecting event enables my paging and sorting to work, so I want to use that, but again, it's turning out that I'm putting *everything* there, like all the page's logic, and I'm thinking that is not good? if I could just pass in the actually query, like an IQueryable<T>, and keep my logic separated.

View 8 Replies

DataSource Controls :: Passing Parameters In Sqldatasource Storeproc, Dropdownlist And Textbox

Jun 8, 2010

I got DDL1: 10 miles

20 miles

TextBox1 : 'AAA20'

Button:

When user selects 10 miles from dropdownlist DDL1 and types AAA20 in textbox1 which is of type text, on button click it has to pull all the columns from database and show results in gridview using sqldatasource store procedure. I'm stuck in server side code..how to pull the data..in store procedure I'm passing two parameters val1 and val2. val1 gets data from DDL1 and val2 gets data when user types in textbox1 and it has to validate the text...see the code below mentioned and tell me how to pass the params and get the data in gridview...

[code]....

View 2 Replies

AJAX :: Passing The Parameters In Sql Datasource?

Mar 13, 2011

I have used a sql data source to connect to ORACLE.

Select command is working fine, as soon as I try to provide a parameter, it doesn;t work.

Getting following error " ORA-01036: illegal variable name/number"

Tried searching for error message -- but It says the parameters name has to be less then 32 characters, which is what I have.

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DevConnection %>"
ProviderName="<%$ ConnectionStrings:DevConnection.ProviderName %>" SelectCommand="Select ID, Name from Employee where state = @stateid">
<SelectParameters>
<asp:ControlParameter Name ="stateid" ControlID = "drdState" PropertyName = "SelectedValue" />
</SelectParameters>

View 2 Replies

Forms Data Controls :: ObjectDataSource's Select Parameters?

Feb 28, 2010

I have a DetailsView control with a SelectMethod and two select parameters wich one of the parameters is a control parameter, The parameters are not passed to objectDatasource's select method, the objectdatasource has been defined as follows:

<asp:ObjectDataSource ID="objCurrCompetitor" runat="server" SelectMethod="GetCompetitorByUserAndCompetition"
DeleteMethod="DeleteCompetitor"
TypeName="MZ.Competitions.BLL.Main.Competitor"

[code]...

View 2 Replies

Forms Data Controls :: Passing Null Values To ObjectDataSource

Jan 4, 2011

This is an ASP.NET 3.5 web app written in C# using VS2008 and connecting to an MS SQL backend. It is using ad hoc queries in a strongly typed dataset to pull from the database. This query (shortened for clarity) is designed to allow optional input of parameters (a requirement) or pull all records if no parameters are input. It works normally in SQL Server Management Studio with the addition of Declare and Set statements and it works normally in the TableAdapter's Query Builder:

[Code]....

The markup contains this ObjectDataSource, which is tied to the TableAdapter with the above query:

[Code]....

The problem I'm having is in passing null values to the ODS to feed to the query. Tying the ODS parameters directly to the dropdownlists and textboxes didn't work. Got an error message that there was a mismatched data type. Tried several combinations of code to feed the right values to the ODS parameters but couldn't find one that worked. Is the problem in the query or am I setting up the code-behind wrong? Here's the code:

[Code]....

View 9 Replies

Forms Data Controls :: ReportViewer LocalReport Passing Parameters?

Feb 26, 2010

I know how to pass parameters to Reportviewer in LocalReport mode via textboxes on the page where the user enters them and then they click refresh and everything works fine. What I cannot figure out is how to not pass parameters and make the report display everything, which should be the default.

I know I am missing something really obvious on the Report Parameters screen. Does anybody know the secret?

View 4 Replies

Forms Data Controls :: Passing Parameters To A Popup Dialog?

Oct 26, 2010

I am currently writing an ASP .NET (Framework 3.5) page that has a Grid View inside it.

One of the columns of this GridView contains only buttons, that if clicked should open a popup dialog.

To open the dialog I wrote the following code on the button's event handler:

[Code]....

Now when I click on any of the buttons the dialog opens just fine, however I need to pass some parameters to the dialog so that they can be displayed inside it. That's why I've encoded a Base 64 string and passed it as an argument of the popup dialog (apparently if I just used the plain string, the dialog would not open because the string contained linefeed characters).

Unfortunately I wasn't able to get the parameter (base 64 string) on the code behind of the popup dialog. How can I do this?

View 4 Replies

Forms Data Controls :: Passing Multiple Parameters In Hyperlinkfield In Gridview?

Dec 26, 2010

I have added a gridview in my aspx web page. I have added a hyperlink field, to navigate to another page from the gridview. I am getting the error as:

"There was an error rendering the control.

Index(zero based) must be greater than or equal to zero and less than the size of the argument list. "

This is the code i have used:

[Code]....

[Code]....

When i remove the hyperlink, the grid is getting displayed. I know, there is something wrong i have coded in the DataNavigateURLformatstring, but not sure what is wrong.

I want to pass the StudentID,CourseID,ChildImageID with the link as the querystring.

View 3 Replies

Forms Data Controls :: Passing Dropdownlist Value To Update Parameters In Listview?

Aug 13, 2010

I am trying to pass the value of a dropdownlist to the Update section of a listview. The dropdownlist is bound to one datasource which needs to then pass its selected value to the UpdateCommand sql for another datasource. Here is my code:

[code]....

View 5 Replies

Forms Data Controls :: Passing Multiple Parameters Through The DataNavigateUrlFomratString In GridView?

Apr 29, 2010

I Have a gridview where I have a link to a details page and I need to pass multiple parameters. I currently have the following:

<Columns>
<asp:BoundField DataField="AssocID" HeaderText="AssocID" InsertVisible="False"
ReadOnly="True" SortExpression="AssocID" />
<asp:BoundField DataField="FirstName" HeaderText="First Name"
SortExpression="FirstName" />
<asp:BoundField DataField="MiddleInitial" HeaderText="M. I."
SortExpression="MiddleInitial" />
<asp:BoundField DataField="LastName" HeaderText="Last Name"
SortExpression="LastName" />
<asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
<asp:BoundField DataField="EMail1" HeaderText="EMail 1"
SortExpression="EMail1" />
<asp:BoundField DataField="AddrType" HeaderText="Addr Type"
SortExpression="AddrType" />
<asp:HyperLinkField DataNavigateUrlFields="AddrID,AssocID"
DataNavigateUrlFormatString="Details.aspx?AddrID={0}&AssocID={1}" HeaderText="Details"
Text="Details" />
<asp:BoundField DataField="AddrID" HeaderText="AddrID" InsertVisible="False"
ReadOnly="True" SortExpression="AddrID" Visible="False" />
</Columns>

According to all I have read my DataNavagateUrlFields string should work but it isn't. The deal is that any one (AssocID) can have multiple AddrID's associated with it. Regardless of which I choose I only get back the first AddrID for that AssocId.

View 10 Replies

Can ObjectDataSource Use Table-valued Parameters

Oct 15, 2010

If an ASP.NET web page uses an ObjectDataSource, can you configure it to use a stored procedure that uses table-value parameters?

User-defined type:

CREATE TYPE [dbo].[integer_list_tbltype] AS TABLE
(
[n] [int] NOT NULL,
PRIMARY KEY CLUSTERED
)

Stored procedure:

CREATE PROCEDURE [dbo].[GeneralReport]
@intList integer_list_tbltype READONLY
AS
BEGIN
SELECT * FROM ...
END

ASP.NET

<asp:ObjectDataSource ID="GeneralDataSource" runat="server"
SelectMethod="GetDataByRange"
TypeName="MyProject.GeneralDataSetTableAdapters.GeneralViewTableAdapter"
>
<SelectParameters>
<asp:Parameter Name="intList" />
</SelectParameters>
</asp:ObjectDataSource>

I've tried hooking into the ObjectDataSource's Selecting event like this:

[code]....

be set for UDT parameters." being thrown

View 2 Replies

DataSource Controls :: ObjectDatasource And Class As Datasource

Jun 24, 2010

I am really having a hard time trying to write something from scratch I created a 'Person' Class.Public Class Person

Private _FirstName As String = ""
Private _LastName As String = ""
Private _Age As Integer = 0
Public Sub New(ByVal FirstName As String, ByVal LastName As String, ByVal Age As Integer)
FirstName = FirstName
_LastName = LastName
_Age = Age
[code]...

View 1 Replies

ObjectDataSource Update/Delete Parameters From GridView?

Apr 22, 2010

[code]....

Select method returns array of strings . But How I need to appear selected node for edit delete methods get this string (userName) ?

for methods like :

[DataObjectMethod(DataObjectMethodType.Delete, true)]
static public DeleteMember(...

View 1 Replies

Asp - ObjectDataSource UpdateMethod Passing Updated Values

Mar 24, 2010

I've got a gridview connected to an objectdatasource which is bound to some custom objects in my code (code is below). The problem I'm having is that the value passed into my update method is the old value, not the new value. Thoughts?

Imports System.Configuration
Imports System.Web.Configuration
Imports System.Security.Cryptography
Imports System.Collections.Generic

Partial Public Class ManageUsersControl
Inherits System.Web.UI.UserControl
Dim auth As AuthenticationSection
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Users.DataBind()
End Sub
End Class

Public Class Users
Private sName As String
Private sPassword As String
Public Sub New()
End Sub
Public Sub New(ByVal nm As String, ByVal pass As String)
Name = nm
Password = pass
End Sub
Public Property Name() As String
Get
Return sName
End Get
Set(ByVal value As String)
sName = value
End Set
End Property
Public Property Password() As String
Get
Return sPassword
End Get
Set(ByVal value As String)
sPassword = value
End Set
End Property
End Class

Public Class UserData
Dim auth As AuthenticationSection
Shared userTable As List(Of Users)
Public Sub New()
auth = CType(WebConfigurationManager.GetSection("system.web/authentication"), AuthenticationSection)
End Sub
Public Function CreateData() As List(Of Users)
Dim dt As New List(Of Users)
For Each user As FormsAuthenticationUser In auth.Forms.Credentials.Users
dt.Add(New Users(user.Name, user.Password))
Next
userTable = dt
Return userTable
End Function
Public Function SelectMethod() As List(Of Users)
If userTable Is Nothing Then
Return CreateData()
Else
Return userTable
End If
End Function
Public Function UpdateMethod(ByVal userInfo As Users) As Integer
Dim user As FormsAuthenticationUser = auth.Forms.Credentials.Users(userInfo.Name)
Dim pass As String
Dim sha As New SHA1CryptoServiceProvider()
Dim enc As New System.Text.ASCIIEncoding()
pass = enc.GetString(sha.ComputeHash(enc.GetBytes(userInfo.Password)))
userTable.Add(New Users(userInfo.Name, pass))
user.Password = pass
Return 1
End Function
End Class

and the markup:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ManageUsers.ascx.vb" Inherits="mystuff.ManageUsersControl" %>
<asp:GridView ID="Users" runat="server" AutoGenerateColumns="False"
AutoGenerateEditButton="True" AutoGenerateDeleteButton="True"
DataSourceID="UsersData">
<Columns>
<asp:BoundField DataField="Name" HeaderText="User Name" />
<asp:TemplateField HeaderText="Password" >
<InsertItemTemplate>
<asp:TextBox runat="server" ID="InsertPassword" Text='<%# Bind("Password") %>' />
</InsertItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="EditPassword" Text='<%# Bind("Password") %>' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label runat="server">*****</asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="UsersData"
DataObjectTypeName="mystuff.Users"
UpdateMethod="UpdateMethod"
SelectMethod="SelectMethod"
TypeName="mystuff.UserData"
runat="server"
OldValuesParameterFormatString="original_{0}"></asp:ObjectDataSource>

View 1 Replies

Formview With Objectdatasource Generating Invalid Update Parameters?

Jun 23, 2010

I've a form view with various field in edit and an object datasource where I've defined my update parameters that my update method takes. I've set some of the fields in the edit template to read only because I want them to display.

Unfortunately they are getting passed in as update parameters somehow to my objectdatasource.
So, it is generating update parameters that causes my method to not match.

How can I exclude these parameters from getting sent to update?

View 1 Replies

DataSource Controls :: Objectdatasource Does Not Run?

Jan 26, 2010

I have set the objectdatasource in the web form. Does I need to check anything as I find that method "objProductSuppliment_Inserted" does not run??

-----------------------------------------------------------------------------------------------------------

<asp:ObjectDataSource ID="objProductSuppliment" runat="server"
OnInserted="objProductSuppliment_Inserted"
TypeName="BLL.WMS.ProductSuppliment"

[code]...

View 6 Replies

Forms Data Controls :: Passing Parameters To Stored Procedure When Edit Button Is Clicked In GridView

Oct 27, 2010

I have a grid view that populates and displays data at btn click event from the following sql statement in one of the SP:

SELECT

reg_code, pc_serial, act_code
FROM user_reg
WHERE reg_code=@reg_code

I want to pass parameters to the other Stored procedure when the edit button is clicked in order to update the 2 columns in the specific row at the time. I now how to pass parameters in a regular btn click event or function, but in the case of edit btn in grid view I don't know how to capture data from specific row and then pass it to the SP. Here is Stored Procedure to update the columns (every user always has the same reg code, but may have more than one serial number and activation code, I want to let the user update serial number and then based on the serial number generate new activation code in the SP.):

[Code]....

View 3 Replies







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