LinkButtons in a DataGrid blanks out my complete DataGrid (WTF !!)

Discussion in 'ASP .Net Datagrid Control' started by BTHOMASinOHIO, Aug 20, 2003.

  1. OKay, I am starting to pull my hair out here !!

    Everytime I click on either of my two LinkButtons (in the DataGrid),
    it complete wipes out my DataGrid !! (gone !!)

    Why in the world is it doing this !?!?

    If it helps, here is the HTML part for the DataGrid:

    <asp:datagrid id="DataGrid1" runat="server" Width="662px"
    Height="163px" EnableViewState="False"
    AutoGenerateColumns="False" Font-Names="Verdana" Font-Size="10pt"
    ForeColor="Black" CellSpacing="1"
    CellPadding="3" BorderWidth="1px" HorizontalAlign="Left"
    BorderStyle="Groove" BorderColor="LightGray"
    BackColor="WhiteSmoke">
    <SelectedItemStyle Font-Bold="True" ForeColor="White"
    BackColor="#9471DE"></SelectedItemStyle>
    <ItemStyle ForeColor="Transparent" BackColor="White"></ItemStyle>
    <HeaderStyle Font-Size="12pt" Font-Names="Verdana"
    Font-Bold="True" HorizontalAlign="Left" BorderWidth="1px"
    ForeColor="Black" BorderStyle="Ridge" BorderColor="White"
    VerticalAlign="Bottom" BackColor="#CEC9C1"></HeaderStyle>
    <FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
    <Columns>
    <asp:ButtonColumn Text="VIEW" HeaderText="Function"
    CommandName="selectView">
    <HeaderStyle Font-Size="10pt" Font-Names="Verdana"
    Font-Bold="True" HorizontalAlign="Center"
    Width="50px" VerticalAlign="Bottom"></HeaderStyle>
    <ItemStyle Font-Size="10pt" Font-Names="Verdana"
    HorizontalAlign="Center" ForeColor="Blue"></ItemStyle>
    </asp:ButtonColumn>
    <asp:ButtonColumn Text="EDIT" CommandName="selectView">
    <HeaderStyle Font-Size="10pt" Font-Names="Verdana"
    Font-Bold="True" HorizontalAlign="Center"
    Width="50px" VerticalAlign="Bottom"></HeaderStyle>
    <ItemStyle Font-Size="10pt" Font-Names="Verdana"
    HorizontalAlign="Center" ForeColor="Blue"></ItemStyle>
    </asp:ButtonColumn>
    <asp:BoundColumn DataField="report_year"
    SortExpression="report_year" HeaderText="Year">
    <HeaderStyle Font-Size="10pt" Font-Underline="True"
    Font-Names="Verdana" Font-Bold="True" HorizontalAlign="Center"
    Width="50px" VerticalAlign="Bottom"></HeaderStyle>
    <ItemStyle Font-Size="10pt" Font-Names="Verdana"
    HorizontalAlign="Center" VerticalAlign="Bottom"></ItemStyle>
    </asp:BoundColumn>
    <asp:BoundColumn DataField="survey_type"
    SortExpression="survey_type" HeaderText="Service">
    <HeaderStyle Font-Size="10pt" Font-Underline="True"
    Font-Names="Verdana" Font-Bold="True" HorizontalAlign="Left"
    VerticalAlign="Bottom"></HeaderStyle>
    <ItemStyle Font-Size="10pt" Font-Names="Verdana"
    HorizontalAlign="Left" VerticalAlign="Bottom"></ItemStyle>
    </asp:BoundColumn>
    <asp:TemplateColumn SortExpression="Status" HeaderText="Active">
    <HeaderStyle Font-Size="10pt" Font-Underline="True"
    Font-Names="Verdana" Font-Bold="True"
    VerticalAlign="Bottom"></HeaderStyle>
    <ItemStyle HorizontalAlign="Center"></ItemStyle>
    <ItemTemplate>
    <asp:CheckBox id=checkbox1 runat="server" Checked='<%#
    DataBinder.Eval(Container.DataItem, "Status") %>'>
    </asp:CheckBox>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:CheckBox id=checkbox2 runat="server" Checked='<%#
    DataBinder.Eval(Container.DataItem, "status") %>'>
    </asp:CheckBox>
    </EditItemTemplate>
    </asp:TemplateColumn>
    <asp:BoundColumn
    DataField="hidden_survey_id_number"></asp:BoundColumn>
    </Columns>
    <PagerStyle HorizontalAlign="Right" ForeColor="Black"
    BackColor="#C6C3C6"></PagerStyle>
    </asp:datagrid>

    I can't even get a Response.Write to fire in the DataGrid1_ItemCommand
    Function:

    Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
    DataGrid1.ItemCommand
    Response.Write("HELLO")
    End Sub

    I have some people responding that the DataGrid Binding has to do with
    it? If so, I'm not making the connection !!

    TIA
     
    BTHOMASinOHIO, Aug 20, 2003
    #1
    1. Advertising

  2. (Sorry the snippet of code from the last was a bit hard to read. Try this:)

    (Here is the DataGrid)

    <asp:datagrid
    id="DataGrid1"
    runat="server"
    Width="662px"
    Height="163px"
    EnableViewState="False"
    AutoGenerateColumns="False"
    Font-Names="Verdana"
    Font-Size="10pt"
    ForeColor="Black"
    CellSpacing="1"
    CellPadding="3"
    BorderWidth="1px"
    HorizontalAlign="Left"
    BorderStyle="Groove"
    BorderColor="LightGray"
    BackColor="WhiteSmoke">

    <SelectedItemStyle
    Font-Bold="True"
    ForeColor="White"
    BackColor="#9471DE">
    </SelectedItemStyle>

    <ItemStyle
    ForeColor="Transparent"
    BackColor="White">
    </ItemStyle>

    <HeaderStyle
    Font-Size="12pt"
    Font-Names="Verdana"
    Font-Bold="True"
    HorizontalAlign="Left"
    BorderWidth="1px"
    ForeColor="Black"
    BorderStyle="Ridge"
    BorderColor="White"
    VerticalAlign="Bottom"
    BackColor="#CEC9C1">
    </HeaderStyle>

    <FooterStyle
    ForeColor="Black"
    BackColor="#C6C3C6">
    </FooterStyle>

    <Columns>

    <asp:ButtonColumn
    Text="VIEW"
    HeaderText="Function"
    CommandName="selectView">

    <HeaderStyle
    Font-Size="10pt"
    Font-Names="Verdana"
    Font-Bold="True"
    HorizontalAlign="Center"
    Width="50px"
    VerticalAlign="Bottom">
    </HeaderStyle>

    <ItemStyle
    Font-Size="10pt"
    Font-Names="Verdana"
    HorizontalAlign="Center"
    ForeColor="Blue">
    </ItemStyle>

    </asp:ButtonColumn>

    <asp:ButtonColumn
    Text="EDIT"
    CommandName="selectView">

    <HeaderStyle
    Font-Size="10pt"
    Font-Names="Verdana"
    Font-Bold="True"
    HorizontalAlign="Center"
    Width="50px"
    VerticalAlign="Bottom">
    </HeaderStyle>

    <ItemStyle
    Font-Size="10pt"
    Font-Names="Verdana"
    HorizontalAlign="Center"
    ForeColor="Blue">
    </ItemStyle>

    </asp:ButtonColumn>

    <asp:BoundColumn
    DataField="report_year"
    SortExpression="report_year"
    HeaderText="Year">

    <HeaderStyle
    Font-Size="10pt"
    Font-Underline="True"
    Font-Names="Verdana"
    Font-Bold="True"
    HorizontalAlign="Center"
    Width="50px"
    VerticalAlign="Bottom">
    </HeaderStyle>

    <ItemStyle
    Font-Size="10pt"
    Font-Names="Verdana"
    HorizontalAlign="Center"
    VerticalAlign="Bottom">
    </ItemStyle>

    </asp:BoundColumn>

    <asp:BoundColumn
    DataField="survey_type"
    SortExpression="survey_type"
    HeaderText="Service">

    <HeaderStyle
    Font-Size="10pt"
    Font-Underline="True"
    Font-Names="Verdana"
    Font-Bold="True"
    HorizontalAlign="Left"
    VerticalAlign="Bottom">
    </HeaderStyle>

    <ItemStyle
    Font-Size="10pt"
    Font-Names="Verdana"
    HorizontalAlign="Left"
    VerticalAlign="Bottom">
    </ItemStyle>

    </asp:BoundColumn>

    <asp:TemplateColumn
    SortExpression="Status"
    HeaderText="Active">
    <HeaderStyle
    Font-Size="10pt"
    Font-Underline="True"
    Font-Names="Verdana"
    Font-Bold="True"
    VerticalAlign="Bottom">
    </HeaderStyle>

    <ItemStyle
    HorizontalAlign="Center">
    </ItemStyle>

    <ItemTemplate>
    <asp:CheckBox
    id=checkbox1
    runat="server"
    Checked='<%# DataBinder.Eval(Container.DataItem, "Status") %>'>
    </asp:CheckBox>
    </ItemTemplate>

    <EditItemTemplate>
    <asp:CheckBox
    id=checkbox2
    runat="server"
    Checked='<%# DataBinder.Eval(Container.DataItem, "status") %>'>
    </asp:CheckBox>
    </EditItemTemplate>
    </asp:TemplateColumn>

    <asp:BoundColumn DataField="hidden_survey_id_number">
    </asp:BoundColumn>
    </Columns>

    <PagerStyle
    HorizontalAlign="Right"
    ForeColor="Black"
    BackColor="#C6C3C6">
    </PagerStyle>
    </asp:datagrid>
     
    BTHOMASinOHIO, Aug 21, 2003
    #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. tfs
    Replies:
    1
    Views:
    409
    John Saunders
    Jun 28, 2004
  2. John A Grandy
    Replies:
    2
    Views:
    2,434
    Eliyahu Goldin
    Nov 21, 2004
  3. Joey
    Replies:
    0
    Views:
    532
  4. Andy Green

    DataGrid LinkButtons on Pocket IE

    Andy Green, Jul 24, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    116
    Andy Green
    Jul 24, 2003
  5. Angela

    LinkButtons in DataGrid

    Angela, Feb 27, 2004, in forum: ASP .Net Web Controls
    Replies:
    7
    Views:
    265
    Jeffrey Tan[MSFT]
    Mar 2, 2004
Loading...

Share This Page