Avatar of Peter Chan
Peter Chan
Flag 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?
C#ASP.NETMicrosoft Legacy OS

Avatar of undefined
Last Comment
Ryan Chong

8/22/2022 - Mon
teebon

Is the grid showing and did you see any error message?
You may want to provide a screenshot.
Ryan Chong

is your datagrid bind to a datasource and got records returned to the screen?
Peter Chan

ASKER
I do not get any error message shown, on the page.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Ryan Chong

>>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?
Peter Chan

ASKER
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

Ryan Chong

>>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?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Peter Chan

ASKER
yes
Ryan Chong

perhaps I should emphasize my question...

>> is your original question asking why the linkbuttons are not being shown OR being disabled in the page?
Peter Chan

ASKER
how to ensure the button is being shown there?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Ryan Chong

>>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
Peter Chan

ASKER
Sorry, GV is being shown. But I do not know why Linkbutton is not shown there.
ASKER CERTIFIED SOLUTION
Ryan Chong

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question