Got stuck when using this control in the update panel. and you got a work around by making a pop up window to download the file through it.
This is not the case here, now you can use the ordinary file upload in the update panel! the only thing you have to do is making the button that "submit" to be postback from updatepanel triggers.
< update panel>
< content template>
< /content template>
< triggers>
< ! -- here is your ascync trigger -- >
< / triggers>
< /update panel>
Note: make sure that the control in the triggers tags is visible, if you want to hide it try style="display:none;" attribute.
if you are using a master page that contains an update panel and you want to do it. you can add this line to the page load event:
ScriptManager.GetCurrent(Page).RegisterPostBackControl(Button1);
now it is fine and working properly :)
Tuesday, December 16, 2008
Monday, December 1, 2008
what is Future of Gaming?
Now what? the question I got into my head about the gaming industry. Now we have WARP in windows 7, and intel i7, and DirectX 10, besides the GPU. They are all maximizing the power of the games rendering and blending. Which will open the gates for a new games that have richer interface and much more bump mapping textures.
You know what? all that means in simple statement that the game will use the GPU and CPU for game processing. which leed to GPU+CPU(cores). It may seem like running the game upon maultiple processors on your computer. interesting.
It is a thread world after all. The more you use thread the better code it will be. and this can be done from the IDE itself!!!
After all, lets cruse the new threading world.
Labels:
DirectX,
Game,
GPU,
Graphics processing unit,
Intel Core i7
Does your website contain a malware, infection?
Too long for not writing anything in the blog. But it seems I missed it a lot.
one question in the subject, are you sure your web content is safe? if you are sure from the content you type. Then may be the users that write reviews or commenting had something else.
in the article below you will find 3 online tools to discover if your website contains malware, unauthorized content, your bad neighbors.
Trust me it is useful to check your site from time to another. to check its content.
check the site for more info.
http://www.labnol.org/internet/detect-webpages-that-serve-malware/5597/
one question in the subject, are you sure your web content is safe? if you are sure from the content you type. Then may be the users that write reviews or commenting had something else.
in the article below you will find 3 online tools to discover if your website contains malware, unauthorized content, your bad neighbors.
Trust me it is useful to check your site from time to another. to check its content.
check the site for more info.
http://www.labnol.org/internet/detect-webpages-that-serve-malware/5597/
Thursday, August 21, 2008
Web 2.0 and Indentity
From a long time, discovering passwords and the secret questions were hard to get and almost uses the technical expertise sniffing on ports, and hacking the target computer by applications or even using brute force attack, and getting some information about the domain you would like to hack, and all these stuff. The hardest part was to crack someone's identity over the web. It has to be through the relationship between you and the person you would like to hack. So, you sneak around him/her and watch the different activities he/she does to guess what he/she likes - like pets, furniture, trees, flowers...etc - it was the hardest part. It turns that you are a spy on him/her.
Web 2.0 has been coming. This sentence has changed the world. Many many people will be writing their stories and experience. The content will be from the users not from the companies. There were a punch of tools like blogging and wiki and other tools that make Web 2.0 more powerful. Yet we have a huge source of information getting from the people themselves and the companies. Pretty Cool huh !!!!
Now it is getting clear enough that Web 2.0 drives the identity to be public and more than that readable by hackers and crackers. I read this article How I Stole Someone's Identity, and I got shocked, not that shock when you touch electricity, but yeah your identity and my identity are public now. Anyone can read it and download it, and spend a day discovering my hobbies and my interests and begin trying to access my e-mail that i gave him. and then trying to access my visa number that I talked about it once in my blog, but not this blog :), and then ta da. I got busted and then I will receive a letter from the bank that I make my balance zero :( :( :( .
I guess from now, secrets should be kept in your mind only. Do not talk about yourself loudly, or you got busted by many hackers...
Now it is getting clear enough that Web 2.0 drives the identity to be public and more than that readable by hackers and crackers. I read this article How I Stole Someone's Identity, and I got shocked, not that shock when you touch electricity, but yeah your identity and my identity are public now. Anyone can read it and download it, and spend a day discovering my hobbies and my interests and begin trying to access my e-mail that i gave him. and then trying to access my visa number that I talked about it once in my blog, but not this blog :), and then ta da. I got busted and then I will receive a letter from the bank that I make my balance zero :( :( :( .
I guess from now, secrets should be kept in your mind only. Do not talk about yourself loudly, or you got busted by many hackers...
Labels:
Blog,
Brute force attack,
Identity,
Web 2.0
Tuesday, July 15, 2008
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)
If you have this exception, with wired error message and the stack trace is some how freeek.
Simply, this exception occurs when you have a server side call from javascript located at the head tag of the html like that
Simply, this exception occurs when you have a server side call from javascript located at the head tag of the html like that
< head runat="server" >
< script >
var controlClientObject = <%= RadControl1.ClientID %>
...
< / script>
< body >
...
you should do that
I googled a lot and this is what concluded.
ref. http://www.telerik.com/help/aspnet/menu//menu_move_codeblocks.html< script >
var controlClientObject = <%= RadControl1.ClientID %>
...
< / script>
< body >
...
you should do that
< head runat="server" >
< body >
< script >
var controlClientObject = <%= RadControl1.ClientID %>
...
< / script >
...
< body >
< script >
var controlClientObject = <%= RadControl1.ClientID %>
...
< / script >
...
I googled a lot and this is what concluded.
Monday, May 19, 2008
Excel Export
the problem is we don't know how to deal with excel, and how excel deals with data connectors like ODBC.
I faced these issues and searched a lot to get a result and got these guidelines.
1- for loading an excel file make sure you format the excel file to the desired format you want. example: if you only will get the data in number format, so format the column with the suitable numeric format. so that all the data that you will have is the numbers, if you types a word in this column, excel will not transfer this value to the ODBC driver.
If you want it generic so you will format it as text. so whatever gets into the cell excel will transfer it.
here is a snippet of how loading from excel. [the code is in C#]
public DataTable LoadSheet(string sheetName)
{
DataTable dtSheet = new DataTable();
string excelConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FilePath + ";Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1\";";
string command = "select * from [" + sheetName + "$]";
new System.Data.OleDb.OleDbDataAdapter(command, excelConString).Fill(dtSheet);
return dtSheet;
}
this how to load a sheet of excel into DataTable which you can deal with in the rest of your code.
*Trick: when reading, excel considers the first formatted row as the table header [formatted means bordered] if you did not do that the headers will be F1, F2...etc
2- Writing to Excel. the problem begins.
- first you have to export to a named sheet
- the sheet should be in a table format, if you typed in this sheet before exporting the writing process will begin writing after your writing. example: you write in cell A2, when exporting the excel will begin writing from A3, B3,C3...etc.
- any formats should be applied on the previous cell that you want to write in. example: you to begin writing in cell A4, and you want it to be formated as numeric (#.00). So, you have to apply this format on cell A3 only and not the column.
- now you need the way to insert the rows.
connection.Open();
OleDbCommand command;
// insert rows
foreach (object item in items)
{
// insert row
command = CreateInsertCommand(sheetName, fields, connection, item);
command.ExecuteNonQuery();
}
private OleDbCommand CreateInsertCommand(string sheetName, ExcelField[] fields, OleDbConnection connection, object item)
{
StringBuilder builder = new StringBuilder();
string fieldValue;
OleDbParameter parameter = null;
int count = fields.Length;
OleDbCommand command = connection.CreateCommand();
for (int i = 0; i < count; i++)
{
fieldValue = (item is DataRow) ? fields[i].GetDataRowValue(item) : fields[i].GetValue(item);
if (i == 0)
{
builder.AppendFormat("insert into [{0}$] values(?", sheetName);
}
else
builder.Append(", ?");
parameter = new OleDbParameter(string.Format("param{0}", i), GetOleDBType(fields[i].FieldType));
parameter.Value = fieldValue;
command.Parameters.Add(parameter);
if (i == count - 1)
builder.Append(")");
}
command.CommandText = builder.ToString();
return command;
}
and tada it did insert the rows.
*Tricks: make sure you cast the fields values to its proper type.
Now the nightmare part. the calculations and advanced formatting. this is an excel behavior. if you need to do this you have to create a separate sheet for viewing and other sheets to get the data and make a reference from the view sheet to the other sheets.
the calculations will be on the view sheet. your export function will export to those sheets. And you have to open the file to apply the formatting otherwise it will not affected!!!!
Enjooy the excel loading and exporting.
those tips for formatting Excel.
Labels:
.net,
and Tutorials,
C#,
Excel,
FAQs,
Help,
Microsoft Excel,
ODBC,
Open Database Connectivity,
Programming
Wednesday, May 7, 2008
This is a test For Zemanta :)
Subscribe to:
Posts (Atom)