Hi everyone, i have some problem again
When the user click on the add button, a message box will appear on the screen to allow the user to enter the value to be stored into the database.
What I know is that there is one code which:
btnEdit.Attributes.Add("onclick", "return confirm('Are you sure that you are going to edit the following person(s)?');")
However the output of the message box is not what I want as it does not allow the user to input any value.
hope that there will be someone to show me the sample of the coding
Thank yoummmmmmmmm, Try this
<script language="javascript">
function confirmMsg() {
return window.confirm("Are you sure that you are going to edit the following person(s)?");
}
</script>
btnEdit.Attributes.Add("onClick", "return confirmMsg()")Use prompt instead if you want input.
function howOld() {
var reply = prompt("How old are you?", "")
alert(reply);
}
-MJCHi mjcolli,
do you have any idea if the user input the value into the textbox, how can i get the value from aspx.vb and store it into the database?
thankPut a hidden field on the page. Make sure you put runat="server" in the field:
<input type="hidden" runat="server" id="myHiddenField1" />
In the script take the resulting user input and put it in to the hidden field:
var reply = prompt("How old are you?", "")
document.formName.myHiddenField1.value = reply;
Make sure you reference to the hidden field in the code behind, so you can access the value on postback:
Protected WithEvents myHiddenField1 As System.Web.UI.HtmlControls.HtmlInputHidden
Then just access the value like any other field.
dim myString as string = myHiddenField1.value
When the user click on the add button, a message box will appear on the screen to allow the user to enter the value to be stored into the database.
What I know is that there is one code which:
btnEdit.Attributes.Add("onclick", "return confirm('Are you sure that you are going to edit the following person(s)?');")
However the output of the message box is not what I want as it does not allow the user to input any value.
hope that there will be someone to show me the sample of the coding
Thank yoummmmmmmmm, Try this
<script language="javascript">
function confirmMsg() {
return window.confirm("Are you sure that you are going to edit the following person(s)?");
}
</script>
btnEdit.Attributes.Add("onClick", "return confirmMsg()")Use prompt instead if you want input.
function howOld() {
var reply = prompt("How old are you?", "")
alert(reply);
}
-MJCHi mjcolli,
do you have any idea if the user input the value into the textbox, how can i get the value from aspx.vb and store it into the database?
thankPut a hidden field on the page. Make sure you put runat="server" in the field:
<input type="hidden" runat="server" id="myHiddenField1" />
In the script take the resulting user input and put it in to the hidden field:
var reply = prompt("How old are you?", "")
document.formName.myHiddenField1.value = reply;
Make sure you reference to the hidden field in the code behind, so you can access the value on postback:
Protected WithEvents myHiddenField1 As System.Web.UI.HtmlControls.HtmlInputHidden
Then just access the value like any other field.
dim myString as string = myHiddenField1.value