.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

How to Pass Values Between ASP.NET Web Pages

Posted By: syed shakeer hussain     Posted Date: March 31, 2010    Points: 2   Category :ASP.Net
 
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.


View Complete Post


More Related Resource Links

How to Pass Values Between Web Pages ASP.NET

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

Pass values between user controls on 2 different aspx pages

  
I have 2 user controls that is hosted by 2 different aspx pages.example: srcpage.aspx --> hosts the --> sourceusercontrol.ascxanddestpage.aspx --> hosts the --> destinationusercontrol.ascxI would like the values in the text fields of the sourceusercontrol.ascx to be passed on to the labels in the destinationusercontrol.ascx. I have gone through the MSDN ASP.Net examples and i was able to successfully pass values between two aspx page using the postback URL functionality, but cannot do the same thing with the usercontrols on 2 different aspx pages. Any suggestions would be helpfull....! Thanks..! 

Passing values in pages

  

Hi! Friends..

how to pass the value from one page to another page in asp.net  with out Using State Management Concepts?

Like 1. cookies

        2.Session

        3. QueryStrings

     With out using the above should pass the values...


How to pass values from webgrid1 and webgrid2 to webgrid3

  
I want to pass the values from webgrid1 and webgrid2  to webgrid3 one with checkbox or radio button selection. When i hit the button i want to pass the selected values from each webgrid to the third one.Is that possible?

How to pass values using http header to another domain?

  
Hi,There are two applications "Sender", "Receiver"."Receiver" is a asp.net page, running in a server"Sender" is not an asp.net page and running in some other server."Sender" is passing a string (eg. userName) through http header."Receiver" is reading the string from http header as follows        Request.Header["userName"].How to pass values through http header? Can I have some samples?Thanks,Ashokan

Pass values From Html.BeginForm To Controller

  
I'm using 2 submit buttons. <form id="form1" runat="server"> First name :<asp:TextBox ID="FNanme" runat="server" /><br /> Last name :<asp:TextBox ID="LName" runat="server" /><br /> </form> <% Html.BeginForm("ActionName", "ControllerClass", FormMethod.Post); %> <input type="submit" name="submitButton" onclick=" return popUp1Msg()" value="Reject" /> <input type="submit" name="submitButton" onclick=" return popUp2Msg()" value="Accept" /> <% Html.EndForm ( ); %> On every submit, Popup appears with Ok and Cancel buttons.When user select Ok. How can I pass FName and LName values to controller? Thanks  

How to Pass Values between two Entity Picker?

  
Hi All, I am implementing the SharePoint custom fields to pull the data from the SQl Database. This custom field contains two entity picker (like people picker) where the first one will get a record from the Parenet records and second picker has to get the record based on the parent selection. Everything works fine except passing the first entity picker value to second one. Any one has any ideas how to do this? I am trying to use the custom Property in the follwoing way public     RecordPickerData PickerData {     get {     string s =     if (_pickerData == null && String.IsNullOrEmpty(CustomProperty) == false) {     byte[] buffer = Convert.FromBase64String(CustomProperty);     using (MemoryStream stream = new MemoryStream(buffer)) {     BinaryFormatter formatter = new BinaryFormatter(); _pickerData = (   RecordPickerData)formatter.Deserialize(stream); } }     return _pickerData; }     set {     if (value != null) { _pickerData =   value;     using (MemoryStream stream = new MemoryStream()) {     BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, _pickerData); CustomProperty =   Convert.ToBase64String(stream.ToArray()); }

How to pass string values to parameterized sql query in Clause?

  
Hi,I'm using parameterized sql query to get data from database string query = "Select * from employee where employee_city in (@value)";strign city ="'NewDelhi','Bangalore','Mumbai'";I'm using following code to achive thisDataSet ds = new DataSet();SqlConnection con = new SqlConnection("Server=localhost;....");SqlCommand cmd = new SqlCommand();cmd.CommandText =query;SqlParameter param = cmd.Parameters.Add("@value",SqlDbType.VarChar);param.Value = city;SqlDataAdapter dap = new SqlDataAdapter();dap.SelectCommand = cmd;dap.Fill(ds);But this is not giving the result.If run the query in SQLServer query window as "Select * from employee where employee_city in ('NewDelhi','Bangalore','Mumbai')", records are there.But the same query will not return any records from ADO.Net.How to solve this?Thanks,Ashokan

Any way to pass Multiple Values for a single Label in the Parameter?

  
  I have a Report that Contains 2 Parameters, @Customer & @Area. When trying to set up the Available Values for @Area, I'm having issues using multiple values for one Label, i.e. = "4006" Or "4610" One of the Filters in the Report is an Operation number, which is the [OPERATION] field, which is setup as a filter on the Tablix referencing the @Area parameter.  PROBLEM: I cannot retrieve any data when trying to use the ‘Or’ Operator here. If I simply put “4006” or “4610” I retrieve data, but when trying to combine it returns no data. Example, I need to allow a user to select ‘Chassis Incoming’, which would include data from Operations 4006 & 4610. QUESTION: Any way to pass Multiple Values for a single Label in the Parameter? I realize the typical solution may be to use ‘Multi-Value’ selection, but in this case we want the User to select the Area and the multiple values for Filtering will be automatically determined for them. Otherwise, they are subject to not getting it correct. I have tried several different ways, such as =”4006” Or “4610”, =(“4006”, “4610”), = In(“4006”, “4610”), etc….   Note: We are using Report Builder 3.0  

Can we pass dimension values as parameters in MDX

  

Hi All,

I am doing something similar to basket analysis and I wrote an MDX to see the trend of purchases over time for a customer. How can I dynamically pass values of customer or product purchased into mdx? In below example how can I change [product].[category] value? Also, can we change the dimension also dynamically?

 

with member measures.x as

Pass Checkboxlist control multiple selected values to SQL table

  

Hi,

I wanted to know if it is possible to pass multiple selected values from Checkboxlist to SQL table so each selections goes into separate row in the table.

I tried it using the following code (to pass ShowDate value) but it enters value only if I make one selection. It gives me an error message if I make two selections and try to pass it to SQL.

 

string showdate = string.Empty;

foreach (ListItem li in BirmShowDates.Items)
        {
            if (li.Selected)
            {
                showdate += li.Value;
            }
        }

            
            conn.Open();

            string sql = "INSERT INTO [BShow] ([Single], [UserId], [ShowDate], [Half]) VALUES (@Single, @UserId, @ShowDate, @Half) SELECT [Single], [UserId],  [ShowDate], [Half] FROM [BShow] WHERE [BShow].[ShowDate] = [BShow].[ShowDate]";

            SqlCommand cmd = new SqlCommand(sql, conn);

cmd.Parameters.AddWithValue("@ShowDate", showdate.ToString());

 cmd.ExecuteNonQuery();
 conn.Close();

Thank you.


Is it possible to pass an array of values, or a custom type as a parameter?

  

I am using a web service as a datasource.  When I create my report I would like to pass
a string array to this web method to retrieve the data for the report.  Is this possible or is there
a similar way to do this such as passing a custom type?

 

thanks,

buckaroov

 


Can't pass DataReader values

  

Why can I not call the global variables CatCode and CompanyName which are equated in the first procedure GetCompanyCatID

And use their new values in the second procedure UpdateCompanyCounts as parameter values.  When I hard code them code their values at the end of the GetCompany CatID procedure the following procedure updates properly. 

 

 string CatCode;   - delcared global
 string CompanyName; - delcared global
 

protected void GetCompanyCatID()
    {
        LinkID2 = Request.QueryString["linkid"].ToString();
        string L_ID = LinkID2;
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString001"].ConnectionString);
        SqlCommand cmd = new SqlCommand("GetCID", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@L_ID", L_ID);
        try
        {
    &nb

editing gridview values to another pages controls

  

i have a gridview in one form showempdetails.aspx

and another form is to edit the value of selected row editempdetails.aspx

in this page i have textboxes and dropdowns.

im using querystring which is bringing empid

(eg: empid=1 should bind all other columns to my controls of editempdetails.aspx)

 

below code is of empedit.aspx this takes loginid to employees_add.aspx

grdEmployeesEdit.EditIndex = e.NewEditIndex;

        Label objEmp = (Label)grdEmployeesEdit.Rows[e.NewEditIndex].Cells[0].FindControl("lbl_loginid");
        string id = objEmp.Text.ToString();
        Response.Redirect("~/Employee/employees_add.aspx?loginid=" + id.ToString());
                
        grdEmployeesEdit.DataBind();

employees_add.aspx.cs i wrote below code

string qslogin = Request.QueryString["loginid"];
        qslogin=objEmployee.P_loginid;//objemployee is my business logic

here by using primary key i should pass all my values of previous selected

Labels & Assembly values not recognised on web pages with .NET 4.0

  

Hi,

I have of a web page that has labels that displays the Assembly Values but all of a sudden they are no longer working???

The project and page was created by the Wizard, I just added the Assembly values

VS2010
Vista 64bit
.NET 4.0
Web Project


SquireDude

How to pass values to another page?

  

Hi,

I have a GridView which contains a set of trades bound to a SQL Server database table with a primary key called tradeId. I want to be able to edit a trade by having an edit button on the GridView. When the edit button is clicked for a record, I want to go to a new page called EditTrade.aspx page. This new page might have a DetailsView form in Edit mode and I want to populate it with the information using the tradeId from the GridView.

My question is what's the best way to pass the tradeId to the page? Should I use Session State? Something else? I'm trying to learn ASP.NET and would like some advice on best practise.

Thanks


Reading Web.Config to pass values to silverlight Application

  
In asp.net application we often use to save the connection string and some other information like user name , web service URL etc in the web.config and then in application read them and use in the application and even we can easily changes these value at later time.However, this scenario does not work out of the box from a Silverlight application, which doesn't seem to even have access to web.config.The reason is simple: a Silverlight application runs on the client side. The XAP -just like the browser- cannot access server resources such as web.config. In this post I will show you how you can read the web.config and pass to the silverlight application and then on the silverlight application how can you read the passed parameters.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend