regarding datagrid with link button in item template

Discussion in 'Software' started by vinodkumarmyakala, Nov 14, 2006.

  1. vinodkumarmyakala

    vinodkumarmyakala

    Joined:
    Nov 14, 2006
    Messages:
    2
    hi !
    this is vinod,
    in datagrid i am getting three fields (as captions from,subject,date) subject i took linkbutton(it is itemtemplate)
    there are no of subject related fields in that subject column.
    my problem:
    when i am clicking the subject link button in the grid all the linkbutton messages are displayed in the grid2 control in which iam retriveing . but i want the particular subject linkbuttons data to be displayed in the grid2.


    this is my source code for a datagrid
    <asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" Height="269px"
    Style="z-index: 108; left: 313px; position: absolute; top: 130px" Width="628px" AllowSorting="True">
    <Columns>
    <asp:TemplateColumn >

    <ItemTemplate>
    <asp:Label ID="order" Visible="false"
    Text='<%# DataBinder.Eval (Container.DataItem, "count1") %>'
    runat="server" />

    </ItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn >

    <HeaderTemplate>From</HeaderTemplate>
    <ItemTemplate>

    <asp:Label ID="L2" BorderStyle ="None" BorderWidth ="0" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"fromuser") %>' />
    </ItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn >
    <HeaderTemplate> Subject </HeaderTemplate>
    <ItemTemplate>
    <asp:LinkButton ID="L3" BorderStyle ="None" CommandArgument="10" BorderWidth ="0" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"subject") %>' OnClick="L3_Click" />
    </ItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn >
    <HeaderTemplate> Date </HeaderTemplate>
    <ItemTemplate>
    <asp:Label ID="L4" BorderStyle ="None" BorderWidth ="0" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"date") %>' />
    </ItemTemplate>
    </asp:TemplateColumn>

    </Columns>
    </asp:DataGrid>


    and for linkbutton my code is:
    string sql = "select entiredata from compose where subject = '" + la + "' and touser = '" + Session["x"] + "'";
    SqlDataAdapter da = new SqlDataAdapter(sql, con);
    con.Open();
    // SqlDataReader dr;
    // dr = da.ExecuteReader();
    da.Fill(ds, "compose");

    GridView1.DataSource = ds.Tables[0];
    GridView1.DataBind();


    con.Close();
    regards
    vinod(venod_14@yahoo.com)
     
    Last edited: Nov 14, 2006
    vinodkumarmyakala, Nov 14, 2006
    #1
    1. Advertising

  2. vinodkumarmyakala

    vinodkumarmyakala

    Joined:
    Nov 14, 2006
    Messages:
    2
    vinodkumarmyakala, Nov 14, 2006
    #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. Kawabzi

    About Datagrid Columns

    Kawabzi, Sep 22, 2003, in forum: MCSD
    Replies:
    2
    Views:
    453
  2. Daniel Joskovski

    Re: Problems facing in datagrid pagecount

    Daniel Joskovski, Apr 7, 2004, in forum: MCSD
    Replies:
    0
    Views:
    488
    Daniel Joskovski
    Apr 7, 2004
  3. mark  mandel

    Start button Right button strange

    mark mandel, Aug 10, 2004, in forum: Computer Support
    Replies:
    1
    Views:
    544
  4. ChrisClayko

    Disable ASP Button in a Datagrid

    ChrisClayko, Aug 2, 2006, in forum: General Computer Support
    Replies:
    0
    Views:
    1,443
    ChrisClayko
    Aug 2, 2006
  5. Amol
    Replies:
    1
    Views:
    334
Loading...

Share This Page