Gridview use question

Discussion in 'ASP .Net' started by Paul, Feb 21, 2007.

  1. Paul

    Paul Guest

    Hi all,
    I'm attempting to build a private message system into a site i'm
    developing. The page which houses the private message code consists of
    a multiview. The multiview contains a view of inbox, compose, reply
    and read - these are switched between depending on the users actions -
    and the active event is used to populate them etc. Firstly, does this
    seem a sensible way of doing this?
    Secondly, to display the contents of the inbox i'm using a gridview
    control. An example of the control I am using can be seen below:

    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <asp:CheckBox runat="Server" />
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField>
    <ItemTemplate>
    <asp:LinkButton Text='<%#Eval("from") %>' PostBackUrl ='<%# "~/
    profile.aspx?user=" + Eval("from") %>' runat="server" />
    </ItemTemplate>
    </asp:TemplateField>
    <asp:TemplateField>
    <ItemTemplate>
    <asp:LinkButton Text='<%#Eval("title") %>' CommandArgument ='<%#
    Eval("idmessage") %>' OnCommand ="title_OnCommand" runat="server" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>

    Is using link buttons in this way ok? The last item template uses the
    id to pass to the read view, and populate the correct email. The only
    thing that concerned me is that when a link is rolled over, rather
    than seeing a nice url as in other mail packages, I see a long
    postback URL. I guess this might be a question of aesthetics?

    Lastly, I'd ideally like to have one column filled with checkboxes
    which allow all selected messages to be deleted. I've attempted to
    databind the field idmessage to the ID property of the checkbox, but
    it doesn't like this. How would I go about adding this functionality?

    Any help would be appreciated.
    Paul, Feb 21, 2007
    #1
    1. Advertising

  2. Paul

    Guest

    Hi all,

    If the other questions cannot be answered the last one is important.
    Is there any way to a checkbox in a template field with a ID from the
    dataset being bound to the gridview? I've attempted <%#
    Eval("columnName") %> but this didn't work as it said databinding was
    not supported. I simply wish to let each row of the gridview have a
    checkbox. When a delete buttong is selected, the checked boxes and
    related column is deleted from the DB. To do this, I need the id.
    , Feb 21, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,946
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  2. Chris S
    Replies:
    0
    Views:
    444
    Chris S
    Dec 13, 2006
  3. =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?=

    Design question regarding use of Gridview

    =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?=, Feb 6, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    396
    =?Utf-8?B?Um9iZXJ0IENoYXBtYW4=?=
    Feb 6, 2007
  4. Cirene
    Replies:
    1
    Views:
    371
    gnewsgroup
    Nov 4, 2007
  5. Robert Chapman

    Design question regarding use of Gridview

    Robert Chapman, Feb 6, 2007, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    136
    Robert Chapman
    Feb 6, 2007
Loading...

Share This Page