Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

Problem to Link button

Hi,
There is Link button below, to the GV
        <asp:GridView ID="gvResult" runat="server" 
            CellPadding="4" ForeColor="#333333" Font-Size="12px" 
            AutoGenerateColumns="False" PageSize="20" 
            DataKeyNames="id"
            style="margin-top: 1px" AllowPaging="True" 
            onpageindexchanging="gvResult_PageIndexChanging" 
            OnRowDataBound="gvResult_RowDataBound" onrowcommand="gvResult_RowCommand">
            <PagerSettings Mode="NumericFirstLast" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False" 
                            CommandName="RowEdit" Text="更改資料" CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                            
                        <asp:LinkButton ID="lbEdit2" runat="server" CausesValidation="False" 
                            CommandName="RowEdit2" Text="更改資料" CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                    </ItemTemplate>
					...

Open in new window

when running the page, the Link button is not shown. But I cannot find out any codes, which are hiding such Link button. Why?
Avatar of teebon
teebon
Flag of Singapore image

Is the grid showing and did you see any error message?
You may want to provide a screenshot.
is your datagrid bind to a datasource and got records returned to the screen?
Avatar of Peter Chan

ASKER

I do not get any error message shown, on the page.
>>is your datagrid bind to a datasource and got records returned to the screen?

I mean..

is your gridview control bind to a datasource and got records returned to the screen?
Yes, GV is binding to a datasource.
Why can't I see the codes that are disabling the button below
 
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False"
                            CommandName="RowEdit" Text="更改資料" CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                           
                        <asp:LinkButton ID="lbEdit2" runat="server" CausesValidation="False"
                            CommandName="RowEdit2" Text="更改資料" CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="30px" />                   
                </asp:TemplateField>
                                ...

Open in new window

>>Why can't I see the codes that are disabling the button below
is your original question asking why the linkbuttons are not being shown or being disabled in the page?
yes
perhaps I should emphasize my question...

>> is your original question asking why the linkbuttons are not being shown OR being disabled in the page?
how to ensure the button is being shown there?
>>how to ensure the button is being shown there?
I don't have a VS with me right now, but you can do quick checks:

-ensure your linkbutton control is visible in the page (not using scripts to set the visible property to false)
-since it's within your GV control, ensure your GV column is not being hidden via scripts (not to set the column's visible property to false)
-there is data that binded to GV, NO data = Nothing will be shown
Sorry, GV is being shown. But I do not know why Linkbutton is not shown there.
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial