I'm experiencing some really odd behavior from the simple onclick event attached to one of my buttons.
I have a user control, with three buttons Save, Edit and Create. They enable different asp.net controls and that's all working fine. However when I click my save button after I have edited some data, the new data is not loaded in with the onclick event of the save button.
So to speak, it just reposts all the old values and stores these in my database again and the new values vanish.
ASP code
Expand|Select|Wrap|Line Numbers
- <table width="300px" cellpadding="5" cellspacing="0">
- <tr>
- <td>
- Navn:
- </td>
- <td>
- <asp:TextBox ID="txtSolutionName" runat="server" CssClass="TextBox200" />
- </td>
- </tr>
- <tr>
- <td width="100px">
- Kunde:
- </td>
- <td>
- <radC:RadComboBox
- ID="rcbCustomers"
- runat="server"
- Height="150px"
- Width="200px"
- MarkFirstMatch="true"
- Skin="WindowsXP"
- HighlightTemplatedItems="true"
- Style="width:200px !important;">
- <Items>
- <radC:RadComboBoxItem Text="---Vælg---" Value="0"/>
- <radC:RadComboBoxItem Text="Baltic Workforce" Value="1" />
- <radC:RadComboBoxItem Text="AV Forlaget" Value="2" />
- <radC:RadComboBoxItem Text="Finn Nygaard" Value="3" />
- <radC:RadComboBoxItem Text="Merrild" Value="4" />
- <radC:RadComboBoxItem Text="FC Fyn" Value="5" />
- <radC:RadComboBoxItem Text="Mitsubishi" Value="6" />
- </Items>
- </radC:RadComboBox>
- </td>
- </tr>
- <tr>
- <td width="100px">
- Skabelon:
- </td>
- <td>
- <radC:RadComboBox
- ID="rcbTemplates"
- runat="server"
- Height="150px"
- Width="200px"
- MarkFirstMatch="true"
- Skin="WindowsXP"
- HighlightTemplatedItems="true"
- Style="width:200px !important;">
- <Items>
- <radC:RadComboBoxItem Text="---Vælg---" Value="0"/>
- <radC:RadComboBoxItem Text="Totalløsning" Value="1"/>
- <radC:RadComboBoxItem Text="Billedbank" Value="2"/>
- <radC:RadComboBoxItem Text="Ekatalog" Value="3"/>
- <radC:RadComboBoxItem Text="Ingen" Value="4"/>
- </Items>
- </radC:RadComboBox>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td align="right">
- <asp:Button ID="btnCreateNewSolution" runat="server" Text="Opret" CssClass="Button" OnClick="btnCreateNewSolution_Click" />
- <asp:Button ID="btnEditSolution" runat="server" Text="Redigér" CssClass="Button" OnClick="btnEditSolution_Click" />
- <asp:Button ID="btnSaveSolution" runat="server" Text="Gem" CssClass="Button" OnClick="btnSaveSolution_Click" />
- </td>
- </tr>
- </table>
Expand|Select|Wrap|Line Numbers
- public partial class ucCreateSolution : System.Web.UI.UserControl
- {
- protected void btnSaveSolution_Click(object sender, EventArgs e)
- {
- UpdateSolution(Convert.ToInt32(Request.QueryString["SolutionID"]));
- txtSolutionName.Enabled = false;
- rcbCustomers.Enabled = false;
- rcbTemplates.Enabled = false;
- btnCreateNewSolution.Visible = false;
- btnEditSolution.Visible = true;
- btnSaveSolution.Visible = false;
- }
- private void UpdateSolution(int solutionID)
- {
- SolutionHandler.UpdateSolution(solutionID, txtSolutionName.Text, 0); //This is where the values are still the old ones, the txtSolutionName.Text takes the old value.
- }
- }
Thanks in advance,
--Michael