Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
the code for my project is shown below:
XML
<table id="tbljobAction" runat="server" visible="false">
           <tr>
                <td colspan="5">
                    &nbsp; &nbsp; &nbsp; &nbsp;
                    <asp:Button ID="btnStart" runat="server" Text="Start" Width="90px" OnClick="btnStart_Click"
                        CssClass="formbutton" />
                    &nbsp;
                    <asp:Button ID="btnHold" runat="server" Text="Hold" Width="90px" OnClick="btnHold_Click"
                        CssClass="formbutton" />
                    &nbsp;
                    <asp:Button ID="btnEnd" runat="server" Text="End" Width="90px" OnClick="btnEnd_Click"
                        CssClass="formbutton" />
                </td>
            </tr>
    </table>



XML
<table>
<tr id="trGridViewJobList" runat="server" visible="false">
            <td colspan="2">
                <asp:UpdatePanel ID="UpdatePanel_Grid" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:GridView ID="GridViewJobList" runat="server" AutoGenerateColumns="false" CssClass="gridTable"
                            EmptyDataText="No Record Found" DataKeyNames="Entry_No" OnRowDataBound="GridViewJobList_RowDataBound"
                            Width="100%" GridLines="None" AllowPaging="True" PageSize="14" OnPageIndexChanging="GridViewJobList_PageIndexChanging">
                         <Columns>
                                <asp:TemplateField ItemStyle-Width="2%">
                                    <ItemTemplate>
                                        <%#Container.DataItemIndex+1 %>
                                    </ItemTemplate>
                                    <ItemStyle Width="2%" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="Entry_No" HeaderText="Entry No" ItemStyle-Width="7%">
                                    <ItemStyle Width="7%" />
                                </asp:BoundField>
                          <asp:TemplateField HeaderText="Promise Date" ItemStyle-Width="10%">
                                    <ItemTemplate>
                                        <asp:Label ID="lblPromisedDateTime" runat="server" Text='<%# Eval("Promised_Date_Time").ToString()=="1/1/0001 12:00:00 AM"? "":Eval("Promised_Date_Time","{0:MM/dd/yyyy}").ToString() %>'>
                                        </asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="10%" />
                                </asp:TemplateField>
                            </Columns>
                            <PagerSettings PageButtonCount="14" />
                            <PagerStyle BorderWidth="1px" Font-Bold="True" Font-Size="15px" />
                        </asp:GridView>
                        <%--                        <asp:Timer ID="Timer" runat="server" Interval="5000" OnTick="Timer_Tick">
                        </asp:Timer>--%>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
</table>

what i want is when user clicks on a particular record in gridview, tbljobAction table must be made visible and entry no (i.e primary key of row) must pass to control of button..
i had used javascript using GridViewJobList_RowDataBound event to pass entry to client side. can i make tbljobAction visible using the code. or can anyone help me on alternate method???
Posted

1 solution

Refer my previous solution fire client side event for gridview on selection of row in asp.net[^].
Instead of doing visible="false", do style="display: none;". Because when you set Visible false, it don't render that on browser, so you won't be able to do anything to that in client side.

Now in that JavaScript function, try to remove the display: none.
C#
function gridRowOnclick(element)
{
    alert("GridView clicked");
    var yourTable = document.getElementById("tbljobAction");
    yourTable.style.display = yourTable.style.display === 'none' ? '' : 'none';
}
 
Share this answer
 
Comments
Codes DeCodes 9-Jan-14 23:52pm    
thanks for the code man..
Most welcome buddy. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900