Store Formatinformation of an Datagrid

Discussion in 'ASP .Net Datagrid Control' started by Gh0st, Jan 10, 2005.

  1. Gh0st

    Gh0st Guest

    Is it possible to Store the format of an Datagrid (color,size,... of
    each Cell/Row/Column), to use it on another Datagrid??

    At the Moment I have a Datagrid an I store it in a Session-Variable

    Session("Print") = DataGrid1

    Then I open a new Webpage

    Response.Write("<script
    language=JavaScript>window.open('print.aspx?Table=Turnover&Start=" &
    Request("Start") & "&Ende=" & Request("Ende") & "&DepValue=" &
    Request("DepValue") & "&StoValue=" & Request("StoValue") &
    "');</script>")

    At this Page I have an Datagrid and I'm trying to Reassign the Stored
    one

    DataGrid1 = Session("Print")
    DataGrid1.DataBind()

    In the Datagrid1 is the same as in the Stored one, but the Datagrid1
    isn't shown but Datagrid1.Visible =true
     
    Gh0st, Jan 10, 2005
    #1
    1. Advertisements

  2. Gh0st

    ghosthunter Guest

    Hi Thomas,

    thanks for your answer. The problem with CSS is, that the data I read
    into my Datagrid can be different, also the width, backcolor,.. from
    the columns, that all depends on the shown informations, and is
    genereated "by hand".

    That's why I'm searching for a way to store the
    Datagrid-Style-Informations

    A short description of my Project:

    I have 6 different Categories for my Data's. And one Datagrid that
    displays the data which is choosen. That all works fine, because I know
    how the Datagrid should look for each Category.

    But now I've added a Print-preview Button which opens a new site and on
    this my datagrid is displayed without Paging, so I can Print all Rows
    at once. Also works fine, except the DatagridStyle that should look
    like in the "original". And I don't want to add the 6
    Datagrid-format-routines to the Print-Preview.aspx.

    Can't be that there is no "professional" way of copy the Styleinfo's.
    or?
     
    ghosthunter, Jan 11, 2005
    #2
    1. Advertisements

  3. Are u saying that you are generating data dynamically hence you are creating
    the dg style dynamically?
    If so you can apply CSS based on what data is shown dynamically too right?
    Or did I get you wrongly?
    R. Thomas
     
    R. Thomas, aka Xtreme.Net, Jan 12, 2005
    #3
  4. Gh0st

    ghosthunter Guest

    I have different data's about a store. In one category I show the
    Turnover from one day in another category from a month and in the next
    one the ZIP-Code from the Customers and so on.

    I get the data out of an Database and display it in my datagrid. The
    data's are always different for the categories and have to be shown
    different.
    For eg.
    The fist colum should be written left-aligned the next one
    right-aligned and the background from the 3rd should be RED. In the
    next category it is displayed all centered an WHITE background.

    Hmmm while reading this I think I get an idea of what you think about.

    You say if I know how the data should be shown I should generate my CSS
    this way that i have for each cateory a CSS-Style that defines the
    style of my Datagrid.

    Sounds like a good idear, but I have no plan how I have to write a
    CSS-Style for a whole datagrid/table, is that possible? If i write it
    for each row seperatly that would be a lot of code.
     
    ghosthunter, Jan 12, 2005
    #4
  5. Yes that is what I am saying, you are the author of the data in the grid, so
    author the css for it as well at the same go.
    Lot of code yes, but then you are trying to achieve something of a very high
    end right?
    So what's the problem with lot of code?
    If I were you, I'd write a function and I will let the function change the
    apprearance of all the datagrids.
    The funcion will check for the value present and apply CSS accordingly.
    Doesn't sound very difficult, does it?
    P.S : If this post helped you, please click 'Yes' on top of this thread to
    close the thread.Thanks
    HTHs....
    R. Thomas
     
    R. Thomas, aka Xtreme.Net, Jan 13, 2005
    #5
  6. Gh0st

    ghosthunter Guest

    Yes thank you as soon as I have time I will start with the CSS, thanks
    for your help.

    Btw. I can't find the "Yes" on top of this thread is this at thread.
    Has this changed @groups-beta.google.com?
     
    ghosthunter, Jan 13, 2005
    #6
  7. I meant the 'Yes' button on top of this POST...
    Thanks
    R. Thomas
     
    R. Thomas, aka Xtreme.Net, Jan 13, 2005
    #7
  8. Gh0st

    ghosthunter Guest

    hmm there is only a hide options button on top of each post,
    R. Thomas, aka Xtreme.Net Jan 12, 11:13 pm hide options

    if I click on it there are some options
    Reply | Reply to Author | Forward | Print | Individual Message | Show
    original | Report Abuse

    But I think noone will close the Thread.
     
    ghosthunter, Jan 13, 2005
    #8
  9. Huh?
    Do you see the quote :
    Was this post helpful to you?
    and the twho buttons : |Yes| |No|
    Right on top of this post?
     
    R. Thomas, aka Xtreme.Net, Jan 14, 2005
    #9
  10. Gh0st

    ghosthunter Guest

    No there is nowhere the text "was this post useful to you".
     
    ghosthunter, Jan 14, 2005
    #10
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.