postback cann't get the value of the server-side control checkbox correctly

Jun 1, 2009 at 6:40 AM

postback cann't get the value of the server-side control checkbox correctly ?


 <fjx:FileUploader ID="FileUploader1" runat="server"
                                    AllowedFileTypes="compress file(zip,rar):*.zip;*.rar;"
                                    ImagesPath ="~/images/uploader/"
                                    CloseButtonUrl="images/uploader/CloseButton.gif" CssUrl="~/css/uploader.css"
                                    MaxFileNumberReachedMessage="Only on file to be choosed!"
                                    MaxFileQueueSizeReachedMessage="Filesize more than 500M."
                                    MaxFileSizeReachedMessage ="Filesize reached the max size 500M."
                                        <fjx:FileSaverAdapter Runat="server" FolderName="files/compressfile" OnFileNameDetermining="FileNameDetermining"/>

<asp:CheckBox ID="cbxOrderByName" runat="server" Text="Sort by name ASC" />

back code : 

UploadFileInfo uploadInfo = new UploadFileInfo();

uploadInfo.SortByImageName = cbxOrderByName.Checked;

the value of the cbxOrderByName control comes "true" always .

and There is another question , I cann't get the queringstring from current Request object.


string returnUrl = Request.QueryString["cid"]  ;

the returnUrl will come "null"


Jun 1, 2009 at 5:23 PM

Just a quick tip: when you have problem like that, try to isolate the problem on a separate web page and just then ask the question why something is not working.

Jun 2, 2009 at 5:01 AM

I have done that , the problem still occurs .

Only I cann't get the value of the checkbox and radiobutton 's value correctly. So I do save the checkbox and radiobutton 's value to a hiden input field . I can get the value correctly by the hiden fields , when the page postback .

I am not sure Is it a bug here .



Jun 2, 2009 at 5:56 AM

I just tested your example and I have absolutely no problem getting the checkbox state. 

When I say that you don't try to isolate your problem, I mean it. 

The most important thing when you resolv any kind of problem in the software development is to isolate it. If you can't, then the most simple problems will look to you as enormous.


Jun 3, 2009 at 3:06 AM


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
    <form id="form1" runat="server">
        <fjx:FileUploader ID="FileUploader1" runat="server" RequestAsPostBack="true">
        <asp:CheckBox ID="CheckBox1" runat="server" />


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using com.flajaxian;


public partial class test : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)


    protected void FileNameDetermining(object sender, FileNameDeterminingEventArgs args)
        bool isChecked = CheckBox1.Checked;

the varialbe isChecked's value is always to be "true" , I didn't know why . Or could you send me your code .

thank you very much .


Jun 3, 2009 at 8:46 AM

Your example is technicly speaking not complete, as it should be

<fjx:FileUploader ID="FileUploader1" runat="server" RequestAsPostBack="true">


      <fjx:FileSaverAdapter Runat="server" FolderName="files/compressfile" OnFileNameDetermining="FileNameDetermining"/>



But you were right on the level of FileNameDetermining event the value wasn't set.

Please get the latest version where that is fixed.

Jun 3, 2009 at 9:26 AM

Oh , I missed to paste the event property.

Ah, Ok ,I will get it .

thanks a ton . Hope the control became stronger and perfect .

Jun 4, 2009 at 4:39 AM

the latest version my have some problem remainly.

Flajaxian.requestAsPostBack = function(uploader, array) {
    var form = Flajaxian.findFirstPostForm();
    if (!form) { return; }
    for (var i = 0; i < form.elements.length; i++) {
        var element = form.elements[i];
        var tag = element.tagName.toLowerCase();
        if (tag == "input" && (element.type.toLowerCase() == "checkbox" || element.type.toLowerCase() == "radio") && !element.checked) continue;
        var val = (tag == "select" && element.selectedIndex >= 0)
                        ? element.options[element.selectedIndex].value : element.value;
        if (typeof val != "undeined") array.push({ key: ( ||, value: val, fileID: 0 });

val!="undefined" should be .

I have tested , checkbox's value still invaliable . 

what should form ecrypt attribute to be ?

Jun 4, 2009 at 6:14 AM

Yeah sorry, there was that typo. I made also a few other corrections. Here is a test page for you. Put a break point in the FileNameDetermining method to test.

<%@ Page Trace="true" language="c#" AutoEventWireup="false" %>
<%@ Register TagPrefix="fjx" Namespace="com.flajaxian" Assembly="com.flajaxian.FileUploader"%>
<SCRIPT language="C#" runat="server">
private void FileNameDetermining(object sender, EventArgs e)
  bool isChecked1 = CB1.Checked;
  bool isChecked2 = RB1.Checked;
  string val = DDL1.SelectedValue;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
    <form id="form1" runat="server">
<fjx:FileUploader ID="FileUploader1" runat="server" 
        <fjx:FileSaverAdapter FolderName="UploadFolder" OnFileNameDetermining="FileNameDetermining"/>

<asp:CheckBox ID="CB1" runat="server" Text="Sort by name ASC" />

<asp:RadioButton ID="RB1" runat="server" Text="Sort by name ASC" />

<asp:DropDownList ID="DDL1" runat="server">
    <asp:ListItem Text="1" Value="1"></asp:ListItem>
    <asp:ListItem Text="2" Value="2" Selected="True"></asp:ListItem>
    <asp:ListItem Text="3" Value="3"></asp:ListItem>