Showing posts with label type. Show all posts
Showing posts with label type. Show all posts

Monday, March 26, 2012

updating dropdown list

if i have 2 dropdown list

first dropdown show typeGame from database

the other show the game name that's in choosen type from other database

how can i do?

thank you

Hi,

and welcome to the ASP.NET forums.

You just have to set the AutoPostBack="true" property of the first DropDownList control. In the SelectedIndexChanged event of that control you can capture the selected value and with that value you can access the other database and pass it in as key (most likely a foreign key) to retrieve the data you want.

Grz, Kris.


Since you are posting in the AJAX thread I assume you want to update the drop down lists client side, without requiring a page postback? Check out the CascadingDropDown which is part of the AJAXControlToolkit.

So you will need to download and install the AJAX RC and the AJAX Control Toolkit, both of which can be found here:http://ajax.asp.net/default.aspx?tabid=47&subtabid=471

Here is a link that explains how to use the CascadingDropDown to pull from a database:http://ajax.asp.net/ajaxtoolkit/Walkthrough/CCDWithDB.aspx.

Saturday, March 24, 2012

Uploading file during onchange

I try to upload file in server during user select file:

<inputid="iupload"runat="server" type="file"style="width:1px"/>
<inputtype="hidden"id="hdName"runat="server"/>

<scriptlanguage="javascript">
function Doo(){
document.getElementById('hdName').value = document.getElementById('iupload').value;// to check path
WebForm_DoCallback('__Page',document.getElementById('iupload').value,CallbackFunction,'context',null,false);returnfalse;
}
</script>

and on server side:

protectedvoid Page_Load(object sender, EventArgs e)
{
string argClientFunction ="";
string cScript = ClientScript.GetCallbackEventReference(this, argClientFunction,"CallbackFunction","'context'","null",false);
string f=@dotnet.itags.org."
javascript:Doo();";
iupload.Attributes.Add("onchange", f);

string scr ="<script language=javascript>";
scr +="function CallbackFunction(result, context)";
scr +="{";
scr +="document.getElementById('spUploaded').innerText += 'Done';";
scr +=" return false;";
scr +="}";
scr +="</script>";
RegisterStartupScript("scr" +this.ClientID, scr);

}


publicvoid UploadFile(string fileName)
{
// try to upload file to server
}
publicstring GetCallbackResult()
{
UploadFile(evArg);

evArg = String.Empty;

return evArg;
}
publicvoid RaiseCallbackEvent(string eventArgument)
{
evArg = eventArgument;
}

Problem occur in UploadFile(...): When I try to get iupload.PostedFile for file uploading it's null. I can get file name only.

How can I upload file normally without postback with onchange ?

I need upload file to server as Gmail or Yahoo Mail!

File uploads require a full postback. There has been a lot of talk on here about sites such as gmail that appear to asynchronously load a file. At this point, the only way that I have heard of this successfully implemented is by using IFrames and have another page that does the full postback, but doesn't look like it.


Thank you! I have heard about Iftame to upload files. Have you any information about this?


Not really... we haven't got into handling file uploads very often, and if we do, we would probably use the telerik fileupload control since we have the suite and I believe it handles very large files much better that the built in fileupload for asp.net. When I tested both of them, I was able to crash IIS with the built in control by trying to upload a dvd image because it seemed to check for the file size only after it had been processed through IIS, but the telerik control seemed to do that in pieces which didn't cause it to lock up.

Wednesday, March 21, 2012

urlrewriter + ajax + magicajax : Httpmodule error

The MagicAjax HttpModule is not included in web.config. Add [<httpModules><add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" /></httpModules>] inside the <system.web> section.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:MagicAjax.MagicAjaxException: The MagicAjax HttpModule is not included in web.config. Add [<httpModules><add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" /></httpModules>] inside the <system.web> section.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[MagicAjaxException: The MagicAjax HttpModule is not included in web.config. Add [<httpModules><add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" /></httpModules>] inside the <system.web> section.] MagicAjax.MagicAjaxContext.get_Current() +123 MagicAjax.UI.AjaxControl.SetAjaxIntrinsics() +15 MagicAjax.UI.Controls.AjaxPanel.OnLoad(EventArgs e) +17 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Page.ProcessRequestMain() +731

may be this is not right place, but i have posted the error above every topic not getting solution , and also may be its due to conflict between ajax and magicajax so , hoping to get solution, i m posting in this forum also. Please help , its urgent...

regards,

max

Do you have the ConfigItem in the <httpModules/> as the following codes? If not,try to add it.
<system.web>
<httpModules>
??????<add name="WebResourceCompression" type="Microsoft.Web.Handlers.WebResourceCompressionModule, Microsoft.Web.Extensions, ???????Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
??????<add name="ScriptModule" type="Microsoft.Web.UI.ScriptModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, ???????PublicKeyToken=31bf3856ad364e35"/>
??????<add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" />
</httpModules>
</system.web>
Wish the above can help you.

I'm facing a problem the same error:

The MagicAjax HttpModule is not included in web.config. Add [<httpModules><add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax" /></httpModules>] inside the <system.web> section.

Of course, I have already added this section to the web.config file, but the error keeps display.

Now, I face this case when I try to run the application on Windows Vista Operating System (Ultimate Edition) with IIS 7.0, while I don't get any error if I run and host the application on Windows XP with IIS 6.0.

I think its some configuration problem, but unfortunately I couldn't find any solution for that on the Internet. Some people said its related to Server.Transfer and Response.Redirect. In my application I'm using Response.Redirect as I don't think its the reason behind this error. Any why, I hope that you will be able to support me and help with my case because I need to dimonstrate the project very soon on the Windows Vista Operating System.

I appretiat your help and support.

Thanks,