<asp:Button ID="Button_Add" runat="server" CommandName="SwitchViewByID" CommandArgument="0" Text="Add" OnClick="ActiveViewChanged"></asp:Button> <asp:Button ID="Button_Change" runat="server" CommandName="SwitchViewByID" CommandArgument="0" Text="Change" OnClick="ActiveViewChanged"></asp:Button> <asp:Button ID="Button_Delete" runat="server" CommandName="SwitchViewByID" CommandArgument="1" Text="Delete" OnClick="ActiveViewChanged"></asp:Button> //CommandArgument="0" for Add and Change because structure is the same ... <asp:Label ID="Label_Name" runat="server" Text="Name: "></asp:Label> <br /> <asp:TextBox ID="TextBox_Name" runat="server"></asp:TextBox><br /><br /> <asp:Label ID="Label_Group" runat="server" Text="Group: "></asp:Label><br /> <asp:TextBox ID="TextBox_Group" runat="server"></asp:TextBox> ... <asp:Table ID="Table_1" runat="server"> <asp:TableRow ID="TableRow_1" runat="server"> <asp:TableCell ID="TableCell1" runat="server"> <asp:Button ID="Button1" runat="server" Text="Hallo" OnClick="button_Click" /></asp:TableCell> <asp:TableCell ID="TableCell2" runat="server"></asp:TableCell> ... </asp:TableRow> </asp:Table>
protected void createMethod() { Button1.Text = "Other Test";//here the NullPointer } protected void button_Click(object sender, EventArgs e) { ((Button)sender).Text= "Test"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)