interpeo,
just include a parameter for your strToUppercase() like this strToUppercase(TE_WordValue)
Where TE_WordValue is the value for TE_Word. The trick is you should generate TE_WordValue in the Page_Load routine of your cs file.
-- Js ---
function strToUppercase(TE_WordValue){
Matteo.Web.AtlasMusicArchiver.Admin.Prova.StrToUppercase(TE_WordValue, strToUppercase_callback);
}
Matteo.Web.AtlasMusicArchiver.Admin.Prova.StrToUppercase(TE_WordValue, strToUppercase_callback);
}
-- Web form
<tr>
<td>Insert a word</td>
<td><asp:TextBox ID="TE_Word" runat="server"
Width="160px"></asp:TextBox></td>
<td><span id="resultText"></span></td>
</tr>
<td>Insert a word</td>
<td><asp:TextBox ID="TE_Word" runat="server"
Width="160px"></asp:TextBox></td>
<td><span id="resultText"></span></td>
</tr>
<!-- add this literal in your code -->
<asp:Literal id="ltrLoadScript" runat="server" />
<asp:Literal id="ltrLoadScript" runat="server" />
-- cs --
protected void Page_Load(object sender, EventArgs e)
{
{
if (!Page.IsPostBack)
{
ltrLoadScript.Text = "<script lanaguage='_javascript_'>strToUppercase(\"document.forms[0]." + TE_Word.ClientID + ".value\");</script> \n";
}
}
[AjaxPro.AjaxMethod]
public string StrToUppercase(TE_WordValue)
{
string _result = TE_WordValue;
return _result;
}
public string StrToUppercase(TE_WordValue)
{
string _result = TE_WordValue;
return _result;
}
Hope this help
Lawson
On 7/7/06, interpeo <[EMAIL PROTECTED]> wrote:
Hi everybody,
I tried a simple test with AJAX in ASP.NET page, here is my code:
...
<tr>
<td>Insert a word</td>
<td><asp:TextBox ID="TE_Word" runat="server"
Width="160px"></asp:TextBox></td>
<td><span id="resultText"></span></td>
</tr>
then the script block:
--- script type="text/_javascript_"
function strToUppercase(){
Matteo.Web.AtlasMusicArchiver.Admin.Prova.StrToUppercase(strToUppercase_callback);
}
function strToUppercase_callback(res)
{
if (res.value==null){
alert(res.error);
return;
}
var resultDiv = document.getElementById ('resultText');
if (resultDiv.firstChild)
resultDiv.removeChild(resultDiv.firstChild);
resultDiv.appendChild(document.createTextNode(res.value));
}
--- /script
in the .CS file of the aspx page:
[AjaxPro.AjaxMethod]
public string StrToUppercase()
{
string _result = TE_Word.Text;
return _result;
}
Well, after invoking the function, into my <span> tag, it prints NULL.
So, is it possible to access a TextBox runat="server" (string _result =
TE_Word.Text;)
to get its value?
I hope it's all clear, thanks and regards
interpeo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---
