T
Theo
Hello,
I want to insert values from a dropdownlist and textbox into a table. The
textbox may be visible only if the selectedvalue of the ddl is "2".
My problem is that i need to click two times on the button before the values
are inserted in the table. I put a response.write to check the value: after
the first click, nothing appears, after the second, they appear and are
inserted.
Why is that?
Thanks
Theo
<aspropDownList ID="DropDownList1" runat="server" AutoPostBack=true >
<asp:ListItem Text="x" Value="1"></asp:ListItem>
<asp:ListItem Text="y" Value="2"></asp:ListItem>
</aspropDownList>
<br /> <br />
<asp:TextBox ID="TextBox1" runat="server" Visible="false"
AutoPostBack=true></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="save" />
----------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Page.IsPostBack Then
If DropDownList1.SelectedValue = "2" Then
Textbox1.visible = True
End If
End if
End sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim ddl1, tb1 As String
ddl1 = DropDownList1.SelectedValue
tb1 = TextBox1.Text
Response.Write(ddl1 & " " & tb1)
myclass.save(ddl1,tb1)
End Sub
I want to insert values from a dropdownlist and textbox into a table. The
textbox may be visible only if the selectedvalue of the ddl is "2".
My problem is that i need to click two times on the button before the values
are inserted in the table. I put a response.write to check the value: after
the first click, nothing appears, after the second, they appear and are
inserted.
Why is that?
Thanks
Theo
<aspropDownList ID="DropDownList1" runat="server" AutoPostBack=true >
<asp:ListItem Text="x" Value="1"></asp:ListItem>
<asp:ListItem Text="y" Value="2"></asp:ListItem>
</aspropDownList>
<br /> <br />
<asp:TextBox ID="TextBox1" runat="server" Visible="false"
AutoPostBack=true></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="save" />
----------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Page.IsPostBack Then
If DropDownList1.SelectedValue = "2" Then
Textbox1.visible = True
End If
End if
End sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim ddl1, tb1 As String
ddl1 = DropDownList1.SelectedValue
tb1 = TextBox1.Text
Response.Write(ddl1 & " " & tb1)
myclass.save(ddl1,tb1)
End Sub