HTML table- Selected Row Data from one page to another without Querystring/Session

asp.net , db Ambāla, India
  • 12 years ago

    I have ASP.NET page HtmlTable.aspx in which I show records from Database.
    this records are shown using HtmlTable with Edit and DELETE Option (WHich are Hyperlink controls of .Net.
    I want to EDIT this record on next page by taking unique ID to that page.
    Problem is that I don't want to use QUERYSTRING/Session/Cookies as it is secured data.

    example: i have 4 rows in my HTML table
    and if select 2nd row, by click EDIT linkbutton how will i take 2nd rows values to another table

    Id    Name    Desc    EDIT    DELETE

    1    n1         d1        EDIT    DELETE
    2    n2         d2        EDIT    DELETE
    3    n3         d3        EDIT    DELETE
    4    n4         d4        EDIT    DELETE

     on click EDIT of 2nd row i need value of ID on next page

    I want to know how can I achieve it.

    Thanks for Help
     

  • 12 years ago

    Hi, You can use Application, Cache or Context object to pass values from one asp.net page to another. Please go through the article here: http://steveorr.net/articles/PassData.aspx

    Regards

    meeram. 

     

  • 12 years ago

    actually i need some logic check out the example

    i have 4 rows in my HTML table

    and i select 2 row, how will i take 2nd rows values to another table 

  • 12 years ago

    I don't think you can pass the values of two rows simultaneously from one page to another. If you are putting Edit or Delete hyperlink on each row, you can get the row data by converting any of the column value of the row as primary key, pass those values in next page.

    Otherwise, just try with the CrossPage posting feature in ASP.NET. But not sure about that.

    Thanks

    meeramWink

     

     

  • 12 years ago

    You maybe able to do a cross page postback. Set your button control on the first page to something like

    <asp:Button ID="Button1" runat="server" Text="Button"  PostBackUrl="~/Page2.aspx" />

    Then on Page2 you can call the values from Page1 like

    Response.Write(Request.Form["TextBox1"]);

     

    Now if you need to be able to strongly type on page2. You will then need to add a reference on Page2 to Page1 like so

    <%@ PreviousPageType VirtualPath="~/Page1.aspx" %>

    And on Page1 you will need to set some public

    public string myString

    {

    get { return TextBox1.Text; }

    }

    Now when I type on page2  

    string test = PreviousPage.myString.ToString(); // You can see myString from Page1 is strongly typed on Page2.

    Response.Write(test);

     

     Hope this helps a little, if you look into cross page post backs you will get it ok.

    Take Care.

  • 12 years ago

     Actually I want to pass only 1 row data, that to on clicking EDIT linkbutton to another page.

    so that i can edit that data on another page 

  • 12 years ago

     I don't think u didn't got what i acutally nedd.
    I know i can get the value by Request.Form["TextBox1"]

    Id    Name    Desc    EDIT    DELETE

    1    n1         d1        EDIT    DELETE
    2    n2         d2        EDIT    DELETE
    3    n3         d3        EDIT    DELETE
    4    n4         d4        EDIT    DELETE

     on click EDIT of 2nd row i need value of ID on next page

     

  • 12 years ago

    Hi, Try the code below:

    GridViewRow row = GridView1.SelectedRow;
    string RowId = string.Empty;
    RowId = row.Cells[0].Text // give the column no.which you want

    You can pass this as a context item to the next page.

    if you want to know how to select the rows in Gridview, pls check in the below forum:

    http://www.codersource.net/forums/206/ShowPost.aspx

    Please let me know if you still face any issue.

    Rgrds

    Meeram395

     

     

     

     

  • 12 years ago

    I am Not using Gridview, it is a Plain HTMLTABLE 

  • 12 years ago

     

    I've just given an example of GridView. Just try similar syntax with HTML table or just take the help of google for getting the values of HTML Table.

     

  • 12 years ago

     thats what the problem is how can i do it.

    I have searched and scratched my head but not able to find solution

    plz help me out, i have very limited time to do it 

  • 12 years ago

    still no reply, strange, no one is here with any solution 

  • 12 years ago

    hi,

    u can store each td value in a hidden field and then u can access those hidden fields in the next page

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”