DataSource Controls :: Retrieve Data From SqlDataSource And Pass To A Variable?

Aug 20, 2010

I have a page in my website where there is very little code-behind. I only have two lines of code in Page_Load() and the rest of the code is declarative ASP.NET code. I have a FormView control which uses a SqlDataSource to get some order information. The SqlDataSource calls a stored procedure called usp_GetOrderDetails, here's the code for the SqlDataSource:

[Code]....

<truncated>

What I want is to grab the screenshotId from the SqlDataSource when the usp_GetOrderDetails stored proc gets called and populate it into a field on the page called screenshotId. I then want to use this screenshotId to get an image from the database based on Id. populating the screenshotId field. How do I do this - do I need to have something like OnDataBound or something like that?

View 4 Replies


Similar Messages:

DataSource Controls :: Retrieve Data From SqlDataSource

Mar 31, 2010

I want to retreive some data from an SqlDataSource using it's Selected event I've tried

DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)

but here it's going into in infinite loop and then it gives me an StackOverflowException error in ASP.Net Development Server (my dev machine) and if I publish to IIS it requires me an user name and password to connect to server and gives an InternetExplorer error "Sys.WebForms.PageRequestManagerServerErrorException. An unknown error ... status code returned was 400. The SqlDataSource is in an UpdatePanel. Maybe this is why I get this.

View 1 Replies

Forms Data Controls :: Tie DataSource To SqlDataSource On Aspx Page And Pass Select Parameters?

Nov 10, 2010

[code]....

Is ther a way I can tie DataSource to SqlDataSource on aspx page and pass select parameters?

View 6 Replies

DataSource Controls :: How To Set Variable In Asp:sqldatasource In Sqlcommand In C#

Jun 28, 2010

i want to ask how to i set variable in asp:sqldatasource in sqlcommand in asp.net c#....
This is my code

asp.net
<dx:ASPxListBox ID="lsAssignToko" runat="server" DataSourceID="SqlDataSource6"
TextField="NAMA" ValueField="ID" AutoPostBack="true"
EnableCallbackMode="True" SelectionMode="CheckColumn"
OnSelectedIndexChanged="lsAssignToko_SelectedIndexChanged">
<Columns>
<dx:ListBoxColumn FieldName="ID"/>
<dx:ListBoxColumn FieldName="NAMA" />
</Columns>
</dx:ASPxListBox>
<asp:SqlDataSource ID="SqlDataSource6" runat="server"
ConnectionString="<%$ ConnectionStrings:Ora2010 %>"
ProviderName="<%$ ConnectionStrings:Ora2010.ProviderName %>"
SelectCommand="SELECT ID, NAMA FROM REF_TOKO WHERE ID IN ( :inTOKO ) ORDER BY NAMA">
<SelectParameters>
<asp:SessionParameter Name="inTOKO" SessionField="inTOKO" Size="200" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
c#
string dummy = "";
string data = "";
string inTK = "";
string inTOKO = "";
//string inTOKO1 = "";
int pot;
for (int i = lsToko.SelectedItems.Count - 1; i >= 0; i--)
{
string tok = lsToko.SelectedItem.Text.ToString();
data = lsToko.SelectedItem.Value.ToString();
dummy = dummy + "" + data + ",";
int index = lsToko.SelectedItem.Index;
lsToko.Items.RemoveAt(index);
}
if (lsToko.SelectedItems.Count <= 1)
{
inTK = dummy.Length.ToString();
pot = int.Parse(dummy.Length.ToString()) - 1;
inTOKO = dummy.Substring(0, pot);
}
Session["inTOKO"] = inTOKO;

the problem is where in my variable inTOKO consist of couple of value...
Example
while variable inTOKO = one value success but while value inTOKO = two value error
inTOKO = 1101111 => success
inTOKO = 1101111,1211321 => not success

View 1 Replies

DataSource Controls :: SQLDataSource Outputting Into A Variable

Jan 17, 2011

It seems really easy to output a sqldatasource into a table but really hard to output a sqldatasource into a variable.

View 2 Replies

DataSource Controls :: SqlDataSource Variable Number Of Parameters

Mar 7, 2011

I should perform a Query like this Select * from produtcts where model like @MODEL Now if model is selected from combobox, it should be Select * from produtcts where model like '%MODEL1%' while, if selected chooise is null, it should be like each element in my combobox. how should i do this (in SqlDataSource)

View 5 Replies

DataSource Controls :: Retrieve Total # Of Rows By Using SqlDataSource Calling A SP?

Jan 15, 2010

I am trying to retrieve the number of rows from a stored procedure. I was trying to use @rowCount as an output parameter in my stored procedure but every time I use that SqlDataSource1 won't retrive me any data. Once I removed @rowCount from my SP I get all the data but don't know how to retrieve the Total number of rows :(

I was trying to do this:

protected
void SqlDataSource1_Selected(object sender,
SqlDataSourceStatusEventArgs e)
{
// lblTotalRows.Text = (string)e.Command.Parameters["@rowCount"].Value;
}

View 4 Replies

DataSource Controls :: Pass Value To SqlDataSource Control With StoredProc?

Apr 22, 2010

i have a website with a gridview, i bind the SqlDataSource Control that i use for my Gridview with a StroredProc. but the storedproc has to get a value which is from a textbox so that the gridview can display a record.

View 3 Replies

DataSource Controls :: Set The Parameter Source Of An SqlDataSource To A Variable From Visual Studio?

May 19, 2010

how can i set the parameter source of an SqlDataSource to a variable from visual studio?

View 2 Replies

DataSource Controls :: How To Pass A Variable To SqlDataAdapter

Jan 28, 2010

Would anyone know how to pass a variable to SqlDataAdapter. Here is my code.

TextBox1.Text = 1
Dim textboxval
As
String
textboxval = TextBox1.Text
connection.Open()Using connection
As
New SqlConnection("Data Source=CHRIS-PCSQLEXPRESS;Initial Catalog=TorGHL;Integrated Security=True")
Dim dapubcb
As
New SqlDataAdapter("SELECT [BarName], [MenuSubId], [Address], [PhoneNo], [BarURL], [Email]
[BarDescription], [Id], [bg_long], [bg_lat] FROM [BarDetails] WHERE [MenuSubId] = texboxval ", connection)

View 5 Replies

DataSource Controls :: How To Pass Variable To ObjectDataSource

Sep 10, 2010

I have an objectDataSource which uses my stored procedure GetNotifications

And my GridView is bound to that objectDataSource

the only problem is that my stored procedure requires the variable @UserName and then returns the values for that username, but I do not know how to pass the variable to the objectDataSource, does anyone know the code for this?

I can get userName from HttpContext.Current.User.Identity.Name but how do I pass that to the objectDataSource?

View 7 Replies

Forms Data Controls :: Retrieve Sqldatasource Row From Database?

Apr 5, 2010

I want to retrieve sqldatasource row from database and if = 1/0 set checkbox to checked or not

I am using the sqldatasource and formview. The sqldatasource is bringing in 1 database item via querystring id

I want to read the row entitled 'IsCharacter' which is either 1 or 0 value. If it is 1 I want the checkbox in my formview to be checked. If it is 0, I want it to not be checked.

I could do this with a dropdownlist with value of 1 or 0 which would be easier for me, however, I don't think it would be as user friendly as a checkbox.

Perhaps a radiobuttonlist would be better?

View 7 Replies

Forms Data Controls :: Sqldatasource Using Variable As The Parameter (username)

Jan 19, 2011

I have a Stored Proc which uses a field in the database. that ends up being the user.identity.name. So, when the page loads, it grabs that name and uses it in the stored proc, which I'm which I'm wanting to designate in the sql datasource. But it only gives me choices of querystring, cookie, session, control, etc. My question is how to reference that variable as the parameter in the datasource?

View 3 Replies

Forms Data Controls :: How To Retrieve Current Records Column Of A SQLdatasource

Mar 12, 2010

Formview with some Accordion block. In the block there are some complex structure, displayed with GridView. (but the GriewView is generated dynamically by input ) For the GridView has some rows, I converted it into a string and stored it in a "Column" (or said "field") of a record.

But when i doing search. I cannot bind the gridview to the "column". because string has to be converted manually into dataset to be accepted by gridview.

I just hope to do the coverting in the "Selected" event and databind the gridview with the data converted.

How could I retrieve the current record?

[code]...

View 2 Replies

Forms Data Controls :: SqlDataSource Pass Parameters

Mar 15, 2011

I have big filter coming from database by using storedprocedure. This stored procedure contains about 12 parameters. In asp.net page I select these values and after doing that I want to pass these values to SqlDataSourec which is bound to gridview. How can I pass these values to SqlDataSource, manually in codebehind?

View 8 Replies

DataSource Controls :: Sqldatasource Insert Method - Copy Data To The Other Datasource By Selecting Checkbox

Feb 25, 2010

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?

View 1 Replies

DataSource Controls :: SQLDataSource And Tie A SqlDatasource To A Stored Procedure

May 14, 2010

I am trying to tie a sqlDatasource to a Stored Procedure. The stored procedure looks like...

[Code]........

View 2 Replies

Data Controls :: Retrieve Data In Variable From Ajax

Apr 27, 2016

my code is running correct and all information of table comes in alert giving the formate ..

but i want to retrive value in variable to append customized design result in ajax 

using System;
using System.Collections;
using System.Configuration;

[Code]..... 

i want to this data in div and table so how can retrive this data in ajax in a variable for customized design ...

View 1 Replies

Forms Data Controls :: Pass Variable With Repeater Hyperlink URL

Jan 15, 2010

I query the database to get the VideoName and VideoURL of the videos held in my database (Videos saved on the file system with their location stored in the database) then bind the query results to a repeater with the following code

protected void Page_Load(object sender, EventArgs e)
{
// Variables declaration
string strConnString = ConfigurationManager.ConnectionStrings["vidConnectionString"].ConnectionString;
SqlConnection sqlConn = new SqlConnection(strConnString);
SqlCommand sqlcmd = new SqlCommand("SELECT [VideoName], [VideoURL] FROM [Video]");
SqlDataReader sqlReader;
sqlConn.Open();
sqlcmd.Connection = sqlConn;
sqlReader = sqlcmd.ExecuteReader();
VideoRepeater.DataSource = sqlReader;
VideoRepeater.DataBind();
sqlConn.Close();
}

and put a hyperlink into the repeater to list all the VideoName's this works fine but I want to pass the VideoURL to the next page I am using NavigateUrl="PlayVideo.aspx?VideoURL='<%# Eval("VideoURL") %>'" but when I try and load the Page I get the error saying The server tag is not well formed. the whole repeater code is

<asp:Repeater ID="VideoRepeater" runat="server" >
<ItemTemplate>
<asp:HyperLink ID="VideoLink" NavigateUrl="PlayVideo.aspx?VideoURL='<%# Eval("VideoURL") %>'" runat="server"><%# Eval("VideoName") %></asp:HyperLink>
</br>
</ItemTemplate>
</asp:Repeater>

I'm sure i've just got the hyperlink navigateURL wrong put not sure how else to pass the VideoURL variable

View 9 Replies

Data Controls :: How To Modify Static Variable At Runtime To Pass Data From One Form To Another

Apr 16, 2014

I have using Static Variable  in My project.i want Change Static variable value because of transfer the value b/w two  Forums... and I want Change value at run time...provide solution

Or else Any other way transfer value b/w two forms......

View 1 Replies

Forms Data Controls :: Pass Variable(s) To GridView HyperLinkField's NavigateUrl?

Aug 3, 2010

For example:

<asp:HyperLinkField Text="Edit" NavigateUrl="EditPage.aspx?var1=Variable1&var2=Variable2" />

I realize this can't be done through the page's mark up, at least I think this is so, but if someone could explain the easiest way the concept could work I'd be very appreciative. Basically, I just need a user to be redirected to a page with more than one variable in the url. If you are unclear with what I'm asking don't hesitate to ask me to explain a little better.

View 2 Replies

Forms Data Controls :: ASPxRadioButtonList Inside ASPxDataView Within Item Template - Pass Parameter To Second SqlDataSource (id) To Fill RadioButtonList Property

Aug 29, 2010

I have ASPxDataView and ASPxRadioButtonList within item template. i also have two SQLDataSource's (first fill ASPxDataView, second ASPxRadioButtonList). They are using other database tables connected with the foreign key. Is there any way to pass parameter to my second sqlDataSource (id) to fill RadioButtonList property ? i mean select * from TABLE2 where id = @id ; (@id is a value from TABLE1 which is a value of column returned by first sqlDataSource)

View 3 Replies

Forms Data Controls :: Pass A Variable From Listview Control To A Sub In Visual Basic?

Jan 14, 2010

I'm trying to pass a value (address) from a listview control using visual basic to a google map address control on the page load event. Here is the code I have so far in vb:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Pass address from Listview to Googlemap address
GoogleMap1.Address = ???
GoogleMap1.Zoom = "14"
GoogleMap1.ShowScaleControl = True
GoogleMap1.EnableInfoWindow = True

[Code]....

View 3 Replies

Data Controls :: Send (Pass) GridView Row Values To Next Page Using Session Variable

Nov 6, 2013

i have a gridview with link button and one field called "ID" i have five values....when i click the link button that row value ill show in next page in textboxes ,txtid, txtage, txtsalary,......... if i click that link button that "Id" values should pass to next page using "SESSION" variable in C#.net

View 1 Replies

DataSource Controls :: How To Add Data To SqlDataSource.Inserting Event

Apr 14, 2010

i have built an inserting interface in a GridView's Footer Template. Added Button for insert , auto generated the insertCommand in SqlDataSource. But then how to Bind the data of inserting interface to insert command of SqlDataSource ?In FooterTemplate. i have taken TextBox.GridView's RowCommand Event is handled in this way.

[Code]....

(all that i did , i took help from this web site's tutorial)

So,How to insert data?

View 2 Replies







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