问题
I am getting null value from Plaka .How can I solve this problem.pages created dynamically inside the ascx file .
javascript part:
var myFunction = function()
{
Vp= #{txtPlaka}.getValue();
$("#<%=FileUpload1.ClientID%>").uploadify('upload','*');
};
$(document).ready(function () {
var Vp ="";
$('#btnMusteriEkle').click(myFunction);
$("#<%=FileUpload1.ClientID%>").uploadify({
'uploader': 'Upload.ashx',
'swf': 'uploadify/uploadify.swf',
'script': 'Upload.ashx',
'cancelImg': 'images/cancel.png',
'folder': 'upload',
'multi': true,
'method': 'post',
'buttonText': 'RESIM SEC',
'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg',
'auto': false,
'formData': { 'id': 'id', 'Plaka': Vp, 'Foo':'foooo'},
onAllComplete: function (event, data) {
}
});
});
</script>
upload.ashx file
/// I am getting null value here(pwd5).pwd1 and pwd2 is okey, ///I can catch them values
string pwd5 = context.Request.Form["Plaka"];
string pwd1 = context.Request.Form["Id"];
string pwd2 = context.Request.Form["Foo"];
and here is the markup syntax
<ext:TextField ID="txtPlaka" runat="server" FieldLabel="Plaka" Flex="1" AllowBlank="false" ClientIDMode="Static">
</ext:TextField>
<ext:Button runat="server" ClientIDMode="Static" ID="btnMusteriEkle" Text="Yeni müşteri ekle">
<Listeners>
<Click Handler="
$('#FileUpload1').uploadify('upload','*'))">
</Click>
</Listeners>
</ext:Button>
Here is the my logic I followed: first inside the ready function created var Vp="";later bind the function called myFunction, later, run the uplodify function.when the user clicked the button, this binding already defined ($('#btnMusteriEkle').click(myFunction);), directly run the myFunction and asigned Vp value as #{txtPlaka}.getValue();and run uplodify() function, those value(Vp), should pass the uploadify function but so far, nope doesn't work.
回答1:
Gonna take a wild guess here, i don't know much about ascx files.
Question: Is this the part you use to upload?
$("#<%=FileUpload1.ClientID%>").uploadify({
'uploader': 'Upload.ashx',
'swf': 'uploadify/uploadify.swf',
'script': 'Upload.ashx',
'cancelImg': 'images/cancel.png',
'folder': 'upload',
'multi': true,
'method': 'post',
'buttonText': 'RESIM SEC',
'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg',
'auto': false,
'formData': { 'id': 'id', 'Plaka': Vp, 'Foo':'foooo'},
onAllComplete: function (event, data) {
Meanwhile try this:
var upload;
var myFunction = function()
{
Vp= {txtPlaka}.getValue();
upload()
};
$(document).ready(function () {
var Vp ="";
$('#btnMusteriEkle').click(myFunction);
upload = function(){
$("#<%=FileUpload1.ClientID%>").uploadify({
'uploader': 'Upload.ashx',
'swf': 'uploadify/uploadify.swf',
'script': 'Upload.ashx',
'cancelImg': 'images/cancel.png',
'folder': 'upload',
'multi': true,
'method': 'post',
'buttonText': 'RESIM SEC',
'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg',
'auto': false,
'formData': { 'id': 'id', 'Plaka': Vp, 'Foo':'foooo'},
onAllComplete: function (event, data) {
}
});
}
});
来源:https://stackoverflow.com/questions/19197103/i-am-getting-null-value-from-ascx-file