Forms Data Controls :: Use A Query String Variable Created On The Fly To Populate A Child Webpage?

Feb 22, 2010

I have developed the below web page which has an 3.5 listview control as it's frontend and an sql server db as it's backend.


The first row on the web page is the inserting row. What I am hoping to achieve is that when the user enters their appropriate data they click the "Next" button to assign this dataset with it's own identity ID (customer_id) value within my database (this works perfectly), at the same time on the fly I want to use this customer_id as a query string variable to populate a child page (customerTrades.aspx) in order to pin further data to this identity. Currently I am attempting to use the below code within the iteminserted event of my listview control but I receive the error: "object reference not set to the instance of an object"??

protected void lvTrustAccounts_ItemInserted(object sender,
ListViewInsertedEventArgs e)
string customerID = e.Values["customer_id"].ToString();
+ customerID + "");

Is this because the child page cannot find the customer_id variable being passed through the query string? Because it's not actually created yet? Am I using the wrong listview event? How can I achieve what I am looking for?

I must also mention that I'm using a linqdatasource to insert my data on runtime into my database. However, I am using the listview iteminserting event to insert my frontend dropdownlist selected values, code below:

protected void lvTrustAccounts_ItemInserting(object sender,
ListViewInsertEventArgs e)
= DateTime.Now;
= null;
DropDownList ddl_CountyInsert =
DropDownList ddl_CityInsert =
DropDownList ddl_CountryInsert =
= ddl_CountyInsert.SelectedValue;
= ddl_CityInsert.SelectedValue;
= ddl_CountryInsert.SelectedValue;

View 11 Replies

Similar Messages:

Forms Data Controls :: Query Working In Query Builder But Not In Webpage?

Jul 13, 2010

I'm encountering a strange problem. Here is the scenario. I have built a query that accepts a parameter (WHERE LIKE clause).

I've tested this within the query builder and it returns exactly the number I would expect.

I then go back to my webpage and add the following controls:



the user to make a selection from the dropdown. Postback on the dropdown is enabled so the page reloads and the Gridview displays the filtered results (via an objectdatasource). I've set the parameter to the dropdown control.

The trouble is when I run the page I make the selection in the dropdown no results are displayed. Even though the text displayed in the dropdown control is exactly the same as I inputted into the query builder when testing it.

View 3 Replies

Web Forms :: Pass Session Variable Value In Query String

May 7, 2015

If that Possible then How? 

Response.Redirect("Manage Admin.aspx?AdminId=Select AdminId from Admins where UserName=" + Session["AdminSession"]);

View 1 Replies

Forms Data Controls :: How To Display The String Data Stored In A String[] Variable Into Gridview

Jul 16, 2010

How to display the string data stored in a string[] variable into gridview?

View 9 Replies

Web Forms :: Accept Latin Letters Via Query String And Show Them In The Webpage?

Sep 13, 2010

In my website, where majority of the users are from Norway,I access some values via querystring(eg: email address).Since the members' email ID may contain Latin letters,I am confused and blocked at this level.

My requirements are,

1, I need to access the Latin letters from query string. Is there any thing different from normal query string operations?

2, I need to store these latin Email IDs to my DB ,which is mysql.Any precaution to be taken while storing latin letters to mysql?

3, I need to show these stored email IDs in my web page.Should I use localization(which I have not used yet) for correctly displaying latin letters in webpage?

View 2 Replies

Forms Data Controls :: How To Populate Ddl From Query

Jul 22, 2010

I am having a problem populating my drop down list from my query.

Here is the code I am using:


I still get an empty drop down I am sure I am missing something simple.

View 3 Replies

Data Controls :: Populate TreeView With One Parent And One Child Node Pair From Database

Sep 20, 2015

How to populate or bind TreeView from one table use SQLSERVER database in ASP.NET & C# table include


View 1 Replies

Use Textbox Value On Submit As A Query String Variable?

Jan 12, 2011

How would I take a text box value and use it in the query string on submit? I'd like it to start as this,


and end up something like this after the user enters in a search and clicks search.


The controller action looks like this

public ActionResult Index(string query,bool favorites)
//search code

View 1 Replies

Forms Data Controls :: Populate INSERT Query From Gridview DropDownList?

Apr 21, 2010

I have a Gridview which I'm populating through code behind. A couple of columns of the gridview I've set up to be drop down lists. What I want, is that when I run my Insert query, it takes the drop down list selected value, finds the appropriate ID and uses that ID as part of the insert query.

Below is my select and insert query.


This is the related asp:


View 22 Replies

Forms Data Controls :: Populate Multiple DropDown Lists With One Query?

Jan 17, 2011

I am using a dataset control and I have 5 dropdown lists in which their content depends on what item is selected in each dropdown list.

I know I can populate the lists with 5 different queries taking the variables from each list but I am thinking there must be a better way.

Is there a way to populate each list with one query that takes the distinct items from each column returned without looping through the entire recordset?

View 2 Replies

Forms Data Controls :: Populate Gridview In One Page With One Query With Different Status?

Jan 26, 2011

I have a gridview with column name:

Pending, Waiters, Opened

and in the rows under column there are figures like:

30, 50, 28
65, 0, 214 etc.

My program is working fine, when I am clicking 30, a new page opens and displays 30 rows, when I click 28 another page opens and displays 28 rows and so on.

In datatable there is a column named Stauts, actually Pending, Waiters,Opened are the status.

In dataset in table adapter I used thress queries one for "Pending", second for "Waiters" and third for "Opened".

To display data I created three pages with gridviews.

I used query like:

Select * from ..... Where status ='Pending'
Select * from ..... Where status ='Waiters'
Select * from ..... Where status ='Opened'

What is Required:

I want to make one query with status =@status and want to use header name in query or in coding and want to make only one page to display record.

To put my question as an idea/example I used three status but in real scenarion I have lot of status. If I have lot of status so I have to make lot of queries and have to create lot of aspx pages to display data in gridview that is not the correct logic.

View 4 Replies

State Management :: Secure Query String Or Session Variable

Aug 30, 2010

Example scenario:
User login has a list of associated 'accounts' it has access to... this list of accounts is stored in a database table, say tblAccountAccessControl, something like:

login, accountID
userA, account123
userA, account456
userA, account798
userB, accountABC
userB, accountDEF

This info is used throughout the web application and determines the 'domain' of information the particular login has access to. For example there are many other tables that have the 'accountID' field and whenever a page pulls data from the table it only pulls data that the currently logged in user should be allowed to see, based on that tblAccountAccessControl data.

The security question:
Do I need to query the database every time I need to get this list of allowed accountID's? I was about to use a plain old query string to pass a particular accountID to another page but quickly caught myself as I realized that would be a major security flaw (the receiving page was going to use that accountID to grab info from the database, and there would be nothing preventing a user from simply typing in a url manually to get data from an accountID they are not supposed to be allowed to view). So I then thought I'll just store the list of accountID's in a session state variable so they will be carried with the user throughout the session.

But then I remembered there are tools out there that allow you to easily intercept and modify viewstate information and I'm not sure if that would included session state variables, but I'm guessing they would. Is there a way to create a secure query string? If I used session state would that session state information be exposed and modifyable by utilities out there? Am I just stuck having to query the database every time I need this info to assure security? What about encrypting it and then storing in session state variable (just thought of that one)?

View 5 Replies

Forms Data Controls :: Passing A Variable To Data Source Query?

Feb 26, 2010

I'm using the DetailView control to display employee details from a specfic company, but it seems when I try to create the query in the data source wizard I'm unable to select the variable for the WHERE clause, only the web pages control components.

The employees are selected through the company name which is entered at the beginning of the page and in turn is used to select the company id.

View 2 Replies

DataSource Controls :: Can't Find Query's / By Right Clicking On Database Created A Query In Server Explorer?

May 17, 2010

By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.

View 10 Replies

Forms Data Controls :: How To Get A Value For A Query String

Mar 31, 2011

How can I get the value of a hidden field as the value of a query string parameter?


View 2 Replies

Forms Data Controls :: Get Gridview Item Template Textbox Value To String Variable?

May 27, 2010



Get Gridview item template textbox value to string variable?

View 5 Replies

Forms Data Controls :: Query String To Listview - Set Button In GUI?

Apr 23, 2010

I have a gridview set up with a button that when clicked I want it to send a unique value to a listview which is set to receive the value in a parameterized SQL query. I forgot how to set the button up in the GUI to take the unique value and put it in a query string and send it to url. I would like to use the GUI just to get more familiar with it. I know this is easy but I gortgot how.

View 5 Replies

Forms Data Controls :: How To Add Optional Parameters In Query String

Jan 30, 2010

I have a data grid with a lot of information on it - to easily filter the data, I would like to be able to pass parameters to it. My problem is that I do not want the parameters to be required. So if I just put 1 or 2 of them in the query string, I would like for it to return all of the data related to those two parameters.I am using a data grid & stored procedures:My Stored Procedure looks like this:


View 1 Replies

Forms Data Controls :: Passing Data From Selected Row In Repeater To A Query String?

Feb 12, 2010

I have the following ItemTemplate in Repeater1


How do I insert the value of ListID into the query string?

View 6 Replies

Forms Data Controls :: Select A Grid Row Based On Query String Data?

Jan 13, 2010

I need to know how can I select a gridview row based on a query string data. In my case, the query string will contain the id that exist in the Table related to that grid. Is there a way to do this from the code behind? In other words, if I click a link with that specific query string, can I open the page and tell my grid to select a specific row based on the table row id?

View 1 Replies

Forms Data Controls :: Invoking A Handler With A Parameter In Its Query String

Mar 22, 2010

I'm having troubles passing a parameter to a handler in it's query string. I have a gridview with an image column, this column is defined as a TemplateField, as:

runat="server" ImageUrl='~/ImageHandler.ashx?ID=<%# Eval("EmployeeID")%>'

As you can see, the ImageUrl is a call to a handler that receives the EmployeeID in the QueryString, under the name ID. When I run it, the ImageHandler method receives the following query string "ID=<%" instead of "ID=<the result of Eval("EmployeeID")>", and of course, it throws a FormatException when using it as an int to get the EmployeeID. (If I type ImageUrl="~/ImageHandler.ashx?ID=<%# Eval("EmployeeID")%>" (using " instead of ') the compiler returns the error incorrect server tag) The complete markup is:

ConnectionString="<%&#36; ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Photo] FROM [Employees]">
runat="server" DataSourceID="SqlDataSource1"
HeaderText="ID" SortExpression="EmployeeID"
HeaderText="LastName" SortExpression="LastName"
runat="server" ImageUrl='~/ImageHandler.ashx?ID=<%# Eval("EmployeeID")%>'
Could anybody tell me what am I missing here?

View 1 Replies

Forms Data Controls :: DetailsView Insert Into Table And Query String?

May 7, 2010

I am passing a query string into a new page and want a detailsview to insert whatever comments a user enters

I am getting an error AlbumUID does not accept nulls error.

I thought I passed the query string value to the insert statement but I must have missed something

Here's what I have:

<asp:SqlDataSource ID="SqlDSAddComment" runat="server"
ConnectionString="<%$ ConnectionStrings:MyCDsConnectionStringHome %>"
InsertCommand="INSERT INTO [Comments] ([Comments], [Rating], [AlbumUID]) VALUES (@Comments, @Rating, @AlbumUID)"


View 6 Replies

Forms Data Controls :: Set Text Property Of TextBox In DetailsView To Query String Value?

Sep 19, 2010

I'm tyring to write a simple DetailsView only used for inserting new records that will pre-fill a textbox with a query string value. Here's the DetailsView:


All I want to do is set VenueID_FK.Text to = the "VenueID" querry string. I also want the user to be able to see the VenueID number as they are filling out GridView1.

I know this is probably a simple thing, but I am very new to I thought I could handle this in the page load event, but when I try something like this

TextBox VenueID_FK = (TextBox)DetailsView1.FindControl("VenueID_FK");

And then follow by setting the Text property programitically. I've accomplished something similar to this on a different page using a FormView, but only for ReadOnly mode and it was handled in the databound event on that page.

I get the error "The name 'DetailsView1' doesn't exist in the current context." when trying to do the above mentioned. When trying the same line in the databound event here, I get the same error.

View 1 Replies

Forms Data Controls :: Displaying Search Results From A Query String Into A Listview?

Jan 21, 2010

I'm working on a job seeking website where the job seeker can search for a job , the search box is located in the master page, that's why i passed the keywords as a query string, and then the matching jobs will be displayed in a listview.

the keywords will be taken from two controls: a drop down list which the user can choose the location of the job, and a text box where he can type a keyword.

the select command of the sqlDataSource of the data list is as the following:


View 4 Replies

Forms Data Controls :: Gridview Image Button's Query String Getting Messed Up?

Oct 22, 2010

i put this in a grid so that only one of the rows would have the txt box in it, it works ok ie the txtbox only shows up for the row with 1005 as the ID, but for some reason the query string for each row for the last element in the row, ie an AddToCart image button i have at the end of each row in the grid is not coming out right, ie the query string is missing when the page posts back for all but the last row of the grid which coincidently is the row with the 1005 ID, (the rendered code is shown way down, i apologize for the length of it ) here is the problem line. NOTE when i take the code out of the gridview on row data bound event then the page post back fine and the query string is there, but when i put the code back in the row databound event for the grid then the query string vars and values do not get posted back.


View 4 Replies

Copyrights 2005-15, All rights reserved