Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 单击链接按钮时防止GridView调整大小_Asp.net_Css_Vb.net - Fatal编程技术网

Asp.net 单击链接按钮时防止GridView调整大小

Asp.net 单击链接按钮时防止GridView调整大小,asp.net,css,vb.net,Asp.net,Css,Vb.net,单击“编辑链接”按钮时,如何防止网格调整大小?我只需要修复我的gridview 请注意,单击“编辑链接”按钮时,会出现两个按钮:1个用于更新,1个用于取消,在其他单元格文本框中会出现更新值的按钮,这就是我的网格正在调整大小的原因。。我怎样才能解决这个问题 这是我的asp代码: <asp:GridView ID="GridView1" runat="server" AllowPaging="True" onrowdatabound="GridView1_RowDataBound"

单击“编辑链接”按钮时,如何防止网格调整大小?我只需要修复我的gridview

请注意,单击“编辑链接”按钮时,会出现两个按钮:1个用于更新,1个用于取消,在其他单元格文本框中会出现更新值的按钮,这就是我的网格正在调整大小的原因。。我怎样才能解决这个问题

这是我的asp代码:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" onrowdatabound="GridView1_RowDataBound" 
        AutoGenerateColumns="False" Width="604px" 
        DataKeyNames="id,firstname,lastname,adress,email,telephone,birthday">

        <Columns>
        <asp:TemplateField>

                <ItemTemplate>
                      <asp:CheckBox id="Select" runat="server" OnCheckedChanged="CheckedChanged" AutoPostBack="false"/>
                      <asp:LinkButton  ID="idedit" CommandName="Edit" CausesValidation="true" runat="server"
                            ToolTip="Edit"  Text="Edit"/>
                      <asp:LinkButton ID="selectID" CommandName="Select" CausesValidation="true" runat="server"
                            ToolTip="Select"  Text="Select" />
                    </ItemTemplate>

                <EditItemTemplate>

                 <asp:LinkButton  ID="idupdate" CommandName="Update" runat="server" CausesValidation="false" Text="Update"
                            ToolTip="Update" OnClientClick="javascript:if(!confirm('Are you sure do you want to update this?')){return false;}" />
                        <asp:LinkButton  ID="idcancel" runat="server" CommandName="Cancel" CausesValidation="false"
                            Text="Cancel" ToolTip="Cancel"/>
                </EditItemTemplate>
                </asp:TemplateField>

            <asp:TemplateField HeaderText="firstname">
                <EditItemTemplate> 
                    <asp:TextBox ID="fnmaetxt" runat="server" Text='<%# Bind("firstname") %>'></asp:TextBox>
                    <%--<asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="fnmaetxt" Text="The first name field is required!"/>--%>
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="lblfirstname" runat="server" Text='<%# Bind("firstname") %>'></asp:Label> 
                </ItemTemplate> 
            </asp:TemplateField> 

            <asp:TemplateField HeaderText="lastname">
                <EditItemTemplate> 
                    <asp:TextBox ID="lnametxt" runat="server" Text='<%# Bind("lastname") %>'></asp:TextBox>
                    <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="lnametxt" Text="The last name field is required!"
                                        runat="server" />--%>
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="lbllastname" runat="server" Text='<%# Bind("lastname") %>'></asp:Label> 
                </ItemTemplate> 
            </asp:TemplateField> 

            <asp:TemplateField HeaderText="adress">
                <EditItemTemplate> 
                    <asp:TextBox ID="adresstxt" runat="server" Text='<%# Bind("adress") %>'></asp:TextBox>
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="lbladress" runat="server" Text='<%# Bind("adress") %>'></asp:Label> 
                </ItemTemplate> 
            </asp:TemplateField> 

            <asp:TemplateField HeaderText="email">
                <EditItemTemplate> 
                    <asp:TextBox ID="emtailtxt" runat="server" Text='<%# Bind("email") %>'></asp:TextBox>
                    <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="emtailtxt" Text="Not a Valid Email Address" SetFocusOnError="True" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />--%>
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="lblemail" runat="server" Text='<%# Bind("email") %>'></asp:Label> 
                </ItemTemplate> 
            </asp:TemplateField> 


           <asp:TemplateField HeaderText="telephone">
                <EditItemTemplate> 
                    <asp:TextBox ID="phonetxt" runat="server" Text='<%# Bind("telephone") %>'></asp:TextBox>
                    <%--<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="phonetxt" Text="Not a Valid phone number " SetFocusOnError="True" ValidationExpression="\d{8}"/>--%>
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="lbltelephone" runat="server" Text='<%# Bind("telephone") %>'></asp:Label> 
                </ItemTemplate> 
            </asp:TemplateField> 


           <asp:TemplateField HeaderText="birthday">
                <EditItemTemplate> 
                    <asp:TextBox ID="birthdaytxt" runat="server" Text='<%# Bind("birthday") %>'></asp:TextBox>
                </EditItemTemplate> 
                <ItemTemplate> 
                    <asp:Label ID="lblbirthday" runat="server" Text='<%# Bind("birthday") %>'></asp:Label> 
                </ItemTemplate> 
            </asp:TemplateField> 

        </Columns>

    </asp:GridView>
任何帮助都将不胜感激


提前感谢您

将大小设置为链接按钮,以避免gridview调整大小

<asp:LinkButton  ID="idcancel" runat="server" CommandName="Cancel" CausesValidation="false"  Text="Cancel" ToolTip="Cancel" width="100px" />

这个链接似乎就是你想要的:这个链接对我没有帮助,因为我的问题有点不同。我不确定这就是为什么我把它作为评论而不是答案发布的原因。请你解释一下你想要的是什么?当我点击网格中的编辑链接按钮时,这个链接被另外两个链接按钮替换:更新和取消,网格变得可编辑,这就是为什么当我点击编辑链接按钮时我的网格正在调整大小,我需要防止这个调整大小的问题。。。你明白我的意思了吗?这是我最初理解的。在winforms中,您可以选择根本不允许用户调整DataGridView的大小。从我在这个链接中读到的内容(尽管没有测试),我了解到这与ASP.NET中的GridView是等效的,即锁定datagrid,这样用户就不会影响它的维度;这不是你想要的吗?
<asp:LinkButton  ID="idcancel" runat="server" CommandName="Cancel" CausesValidation="false"  Text="Cancel" ToolTip="Cancel" width="100px" />
gridview.Attributes.Add("style", "word-break:break-all; word-wrap:break-word")