欢迎光临
我们一直在努力

BoundField be changed to textbox in .Net 4.0

Question:
<asp:GridView ID=”GridView1″?? AutoGenerateColumns=”False” DataKeyNames=”Id”?
??????????? runat=”server” onrowediting=”GridView1_RowEditing”>
??????? <Columns>
??????? <asp:BoundField DataField=”Id” HeaderText=”ID” Visible=”False” />
??????? <asp:BoundField DataField=”FirstName” HeaderText=”First Name” />
??????? <asp:BoundField DataField=”LastName” HeaderText=”Last Name” />
??????? <asp:TemplateField>
??????????? <ItemTemplate>
??????????????? <asp:ImageButton ID=”imageButton” AlternateText=”Edit” CausesValidation=”false” CommandName=”Edit” runat=”server” />?
????香港vps??????? </ItemTemplate>
??????? </asp:TemplateField>
??????? </Columns>
??????? </asp:GridView>

public partial class _Default : System.Web.UI.Page
??? {
??????? public class Person
??????? {
??????????? public string FirstName { get; set; }
??????????? public string LastName { get; set; }
??????????? public int Id { get; set; }
??????? }
??????? protected void Page_Load(object sender, EventArgs e)
??????? {
??????????? if (!IsPostBack)
??????????? {
??????????????? List<Person> people = new List<Person>() { new Person { FirstName = “Mike”, Id = 1, LastName = “Myers” }, new Person() { FirstName = “含蓄的保温杯, Id = 2, LastName = “Smith” } };
??????????????? GridView1.DataSource = people;
??????????????? GridView1.DataBind();
??????????? }
??????? }
??????? protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
??????? {
??????? }
??? }
Solution:
change this?’edit’?to other string. ex. ‘edit1’…
<asp:ImageButton ID=”imageButton” AlternateText=”Edit” CausesValidation=”false” CommandName=”Edit” runat=”server” />?
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/310974/viewspace-1985053/,如需转载,请注明出处,否则将追究法律责任。 </p妩媚的烧鹅p高高的音响载于:http://blog.itpub.net/310974/viewspace-1985053/

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。