Posts Tagged .NET

MVC2 LoadingElementID not displaying in Safari

I have a MVC2 project that I am using Ajax form, ajax indicator div (LoadingElementId=”indicator”) displays perfectly in IE, Firefox and Chrome, but it doesn’t display in Safari.

Solution:  change “display:none;” to “visibility:hidden;” in ajax indicator’s css class. Now it works for all browsers above.

, , , , , ,

Leave a comment

MVC2 Ajax not working in Firefox – Error “a is undefined”

I was using MVC2 Ajax function with “this.form.onsubmit()”, it works on IE but not firefox, it causes an error “a is undefined” in /scripts/MicrosoftAjax.js    Line 6

if I use /scripts/MicrosoftAjax.debug.js , it says “Sys.ArgumentUndefinedException: Value cannot be undefined. Parameter name: eventObject”

The solution is here http://forums.asp.net/t/1515105.aspx/2/10  solved by tpeczek.

1. add a hidden submit button in the form, for example:

<inputtype=submit id=”AJAXSubmitButton”name=”AJAXSubmitButton”value=”Update”style=”display:none;/>

2. change ajax call function to

document.getElementById(“AJAXSubmitButton”).click();

so you are forcing the submit button to be clicked, to submit the ajax form.

 

 

, , , , , ,

Leave a comment

C# code to return a dataset from CSV File (No header)

    public DataSet ParseCSVFile(string filepath, string filename)

    {

        DataSet ds = new DataSet();

        string conn_csv_str;

       conn_csv_str = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” + filepath + “;Extended Properties=’text;HDR=NO;FMT=Delimited'”;

 

        string sql_select;

 

        OleDbConnection obj_oledb_con;

        OleDbDataAdapter  obj_oledb_da;

 

        obj_oledb_con = new OleDbConnection(conn_csv_str);

        obj_oledb_con.Open();

 

        sql_select = “select * from [” + filename + “]”;

 

        obj_oledb_da = new OleDbDataAdapter(sql_select, obj_oledb_con);

        obj_oledb_da.Fill(ds);

        obj_oledb_con.Close();

 

        return ds;

 

    }

, , , , , ,

Leave a comment