Showing posts with label urgent. Show all posts
Showing posts with label urgent. Show all posts

Wednesday, March 21, 2012

urgent - plz provide me with help

i m an asp.net dev with C#

i dont know any thing abt ajax

what can i do to learn it through short time

is the "how to " series help me to learn ajax from begining

or another series or a book is better

i prefer vidos

is it ok to begin as i dont know anything abt ajax

When you are a novice in a subject, it means you dont know anything about it. You can easily get along with ASP.NET AJAX and its easy to develop/implement sites in ASP.NET AJAX. There is a lot of stuff available to learn ajax.http://ajax.asp.net

For video's check this linkhttp://www.asp.net/learn/videos/default.aspx?tabid=63#ajax

For any questions or doubts you can use theASP.NET AJAX Forum

Good Luck!


i know that

"There is a lot of stuff available to learn ajax"

my question was

if i dont know any thing about ajax yet

but i know C# and ASP.net

is these videos suffecient to begin with ????

or it needs me to know some about ajax first or to have background about it ????

i dont have even a bachground about ajax but i need to learn it and dont know how to begin

thanks a lot for your care


Well, the links I gave you are for novice and they should help you a lot. A good understanding of the Page Life Cycle, and javascript will be an advantage.

Thanks

Urgent - Trying to make Localization work (RC version)

I am going crazy with localization. It doesn't work :(

I have 2 projects: a web application (ajax enabled) and a class library with a server control.

I have this in my server control:

[assembly:

WebResource("SomeControl.myScript.js","text/javascript")]

[assembly:

ScriptResource("SomeControl.myScript.js","SomeControl.Res","SomeControl.Res")]

The myScript.js file is marked as embedded resource.

I have SomeControl.res and SomeControl.pt-BR.res resource files.

I have EnableScriptLocalization="true" in my ScriptManager.

I am registering myScript.js in the OnInit phase of the server control, like this:

// get script manager

ScriptManager scrMgr =ScriptManager.GetCurrent(this.Page);// register javascript fileScriptReference scriptRef =newScriptReference(

Page.ClientScript.GetWebResourceUrl(

this.GetType(),"SomeControl.myScript.js"));

scriptRef.NotifyScriptLoaded =

true;

scriptRef.ScriptMode =

ScriptMode.Auto;

scrMgr.Scripts.Add(scriptRef);

--

The problem is that the client side resource object is not being generated!!!

When I run the page and look with Fiddler, I have only the contents of myScript.js,but not the contents of the resources that I need.

I should have the contents of the resource files ready to be used client side.

I really need this feature and I am speding hours with this without success... I'd like to know if anyone here could make it work, and if possible, give me a help.

Thanks!

I found the problem :)

I must register myScript.js like this:

// get script manager

ScriptManager scrMgr =ScriptManager.GetCurrent(this.Page);// register javascript fileScriptReference scriptRef =newScriptReference("SomeControl.myScript.js","SomeControl");

scriptRef.ResourceUICultures =

newstring[] {"pt-BR" };

scriptRef.NotifyScriptLoaded =

true;

scriptRef.ScriptMode =

ScriptMode.Auto;

scrMgr.Scripts.Add(scriptRef);

Now it works...

Cheers!

Urgent | PopupControlExtender

Hi,

I have two UpdatePanels on my web page. and i also have a PopupControl Extender on my page. To simplify UpdatePanel1 has a linkbutton and UpdatePanel2(is inside a panel named "popup") has a label. and PopUpControlExtender is like this.

<cc1:PopupControlExtenderID="PopupControlExtender1"TargetControlID="LnkButton1"PopupControlID="popup"runat="server"></cc1:PopupControlExtender>

I want to show this label as popup when one clicks on LnkButton1. But it gives the following error "An extender can't be in a different UpdatePanel than the control it extends".

How can i achieve the above mentioned?

Thanks

Hi

I had a similar problem with an ModalPopup that was outside of the UpdatePanel that contained my TargetControlID and PopupControlID. What I did is I added the ModalPopup to the update panel.

I guess you could try nesting your UpdatePanel2 into UpdatePanel1.



hi,

Thanks a lot..I moved popUpControlExtender inside panel where my tagetcontrolId also lies, and this worked!!!

thanks a lot

Urgent AutocompleteExtender Does not work

Hello ,

I have aproblem with autocomplete extender in Vb website , it does not work at all never call the webservice

here is the code for the page

<asp:TextBox id="TxtITEM_NO" runat="server" CssClass="dbn_tb" Width="225px" autocomplete="off"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="AUTOCOMP" runat="server" ServicePath ="MESCService.asmx" ServiceMethod ="GetItemCompletionList"
MinimumPrefixLength="2" CompletionInterval="1000" EnableCaching="true" TargetControlID="TxtITEM_NO" CompletionSetCount="12" />

and this is the code inside MESCService.asmx

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Collections.Generic

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class MESCService
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Shared Function GetItemCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
If count = 0 Then count = 20
Dim x As New ikrima.DAL.DBAccess
Dim ds As New System.Data.DataSet
ds = x.ExecuteDataSet("select ITEM_ID FROM ITEM_MASTER ")
Dim items As List(Of String) = New List(Of String)

Dim words As Data.DataRow() = ds.Tables(0).Select("ITEM_ID LIKE '" + prefixText + "%'")
Dim num, i As Integer
num = IIf(words.Length < count, words.Length, count)
For i = 0 To num - 1
items.Add(words(i).Item("ITEM_ID").ToString)
Next
Return items.ToArray
End Function

End Class

can any one help me , why this is not work ,

hi ikrima,

Add the following attribute above your webservice class

[ScriptService]

Regards,


Replace this"<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _"line of yours with -----> <ScriptService()> _


Thanks for our replies

i replace my code and change it to <scriptservice()>_ but till now it does not work , and when try to trace my code i found that the autocompleteExtender does not call the webservice , when ever all other ajaxtoolkit is running well

so what is your suggession to solve this ?


HI Ikrima,

Why do you set the propertyautocomplete="off"> ??

Regards,


HI ,

if you rfer to the samplewebsite which is download with AjaxcontrolToolkit source , you will find in the Autocomplete sample they use it ,

actually i try to remove it also but nothing happend

Thanks


Move your MESCService.asmx to your ScriptManager

e.g.

<asp:ScriptManager runat="server" ID="ScriptManager1" EnablePartialRendering="true">
<services>
<asp:servicereference path="~/MESCService.asmx" />
</services>
</asp:ScriptManager>

Hope it works. For it works. For me it does.


Sad , still not working................

Even there is no query on server or any response/request from the page it just ignore it


Sad , still not working................

Even there is no query on server or any response/request from the page it just ignore it


hi i have the same problem in c#,so if u find any solution,please post it here

thanx


replace "<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _" with "<System.Web.Script.Services.ScriptService()> _"


Have you found a solution to your problem?

I found the solution, it seems that the Function name DOES matter. Here is my webservice code returning a generic string array:

Imports

System

Imports

System.Web

Imports

System.Collections

Imports

System.Web.Services

Imports

System.Web.Script.Services

Imports

System.Web.Services.Protocols

Imports

System.Data.SqlClient

<System.Web.Script.Services.ScriptService()> _

<WebService(Namespace:=

"http://tempuri.org/")> _

<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

<

Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Public

Class WebServiceInherits System.Web.Services.WebService

<WebMethod()> _

<ScriptMethod()> _

PublicFunction GetCompletionList(ByVal prefixTextAsString,ByVal countAsInteger)AsString()Dim strArray(2)AsString

strArray(0) =

"abc"

strArray(1) =

"def"

strArray(2) =

"ghi"Return strArrayEndFunction

End

Class

Urgent Help Required

Hi All,

I am new to Atlas Technology. Just I started an application with Atlas but it is not working. I created web site using Asp.net Web site Template instead of using Atlas Web Site template. I refer Atlas dll in my application, then also it is not working, it shows an "Unknown Error" message. Can we use Atlas if the application opened in asp.net web site template. Or we must need to open it in Atlas web site template.

Can any one tell me what are all the requirements needed for Atlas based application, that is in Client and developing machine requirements. Whether we need JVM for running Atlas based application.

I just create a sample web application using Asp.net web site template. The page consist of two text box and two button. One button is "Add" and other button is "Back". If I press Add button it call server side btnadd_Click using Atlas. But it is not working. I am pasting my code here please tell me solution for this.

<atlas:ScriptManager id="scptMgr" runat="server" EnablePartialRendering="true" />

<asp:TextBox ID="txtAstClassName" runat="server"></asp:TextBox>
<asp:TextBox ID="txtAstClassPrefix" runat="server"></asp:TextBox>

<atlas:UpdatePanel Mode="Conditional" ID="atlasUpdate" runat="server">
<ContentTemplate></ContentTemplate>

<Triggers>
<atlas:ControlEventTrigger ControlID="btnAdd" EventName="Click" />
</Triggers>
</atlas:UpdatePanel>
<asp:Button ID="btnAdd" runat="server" Text="Add"

OnClientClick="AddUpdateAssetClass()" OnClick="btnAdd_Click" />
<asp:Button ID="btnBack" runat="server" Text="Back" />

I set web config like this

<

controls>
<

add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas" />
<

add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas" />
</

controls>

In this I call server side Add Click event in Atlas Trigger. But It shows error.

It is very urgent Please help me, Any sample program which is created using Asp.Net web template and Atlas pls send to me.

maximasshel@dotnet.itags.org.yahoo.com

maximasshel@dotnet.itags.org.hotmail.com

Regards,

Maximasshel

Hi,

if you are working with the ASP.NET WebSite template, be sure to reference the Atlas dll but also to update the web.config (the changes you made to your web.config are not enough).

The easiest way to update the web.config is copying it (or the relevant sections) from the Atlas WebSite template.

Hi

I refer dll in my application and I get this config information from other project which is created in Atlas Web Site template.

I just include add button event in atlas trigger, that shows error.

regards,

maximasshel

Urgent Help: Update Panel and Form Templates? - Need to finish this week ends.

Hello

I am new to ASP .NET so just wanted to confirm.

I actually tried a lot in regular asp .net website to update my textboxes when selecting a value from dropdown list.

but no luck.

so is update panel better in these cases. and does this work without having to code..

because i have two weeks left to this one page. and i was stuck on updating values of text boxes, checkboxes fields when updating ddl. i have ddl inside the formview template.

so when using update pannel: ddl will be outside the formview template??

how does it work basically??

please help asap.

thanks a lot all.

looking forward for reply.

surbhi

Have you use the OnSelectedIndexChanged event of the DDL yet ? Make sure you set the DDL AutoPostBack = true

No. I dont know how to use that event.

I am new and using VB for coding ..

Dont know how to use C#..

How do i use findcontrol statements in vb?

help asap. i have to finish it this week..

Thanks

Surbhi


You would probably benefit the most by looking at tutorials online then waiting for people to reply. Questions about events and c# or vb.net syntax can easily be answered by searching.

Well.. Ofcourse I have been looking online as well.

Not finding enough information on how to use this event..

Meanwhile here is my vb code for ItemUpdating event..

I dont know where I am making mistake. Correct me.. and I am using Formview, Sql DataSource.

and DropDownList which has project numbers. I just want to display new values when I select a different value in DDL. I have AutoPostBack=true and AppendDataBound =True..

Here is the code:

Private

Sub FormView1_ItemUpdating(ByVal senderAs Object,ByVal eAs FormViewUpdateEventArgs)'Dim ProjectNameTextBox As TextBox = FindControl("ProjectName")'Dim FormView1 As FormView = CType(sender, FormView)Dim rowViewAs DataRowView = CType(FormView1.DataItem, DataRowView)Dim rowAs FormViewRow = FormView1.RowDim ProjectNameTextBoxAs TextBox = CType(row.FindControl("ProjectName"), TextBox)

e.NewValues(

"ProjectName") = CType(row.FindControl("ProjectName"), TextBox)

ProjectNameTextBox.Text = rowView(

"ProjectName").ToString()

end sub

Urgent Please Help

Thanks for taking time in reading this thread.

I have Gridview contorl inside Update panel

Gridview in dynamic and I have added EditTemplateField to this grid.

When I click on Edit button , page flickers and it does not go into edit event.

I am not using sqldatasource or objectdatasource, I have custom classes.

What do you think is the problem ?

Again Thanks.

For reference here is the code

**************************************Code to create Edit button**************************************

TemplateField templateFieldEdit =newTemplateField();

templateFieldEdit.ItemTemplate =newReportViewHelper(ListItemType.Item, ReaderColumn[ReportViewHelper.ColumnDBName].ToString().Trim(),"Command");

**************************************Design Edit Button**************************************

elseif (_columnControlType =="Command")

{

ImageButton edit_button =newImageButton();

edit_button.ID ="edit_button";

edit_button.ImageUrl ="~/Images/edit.gif";

edit_button.CommandName ="Edit";

edit_button.Click +=newImageClickEventHandler(edit_button_Click);edit_button.ToolTip ="Edit";

container.Controls.Add(edit_button);

}

************************************** this is the method that is not triggering *************************************

void edit_button_Click(object sender,ImageClickEventArgs e)

{

}

Take a look at this articlehttp://aspalliance.com/1125_Dynamically_Templated_GridView_with_Edit_Delete_and_Insert_Options. It's real helpful for creating dynamic templates...

-Damien

Urgent Please! Button CausesValidation

Hi,

I have three buttons inside a tabcontainer which is inside an update panel. Two buttons have causesValidation="False" and when clicked, the button event fires. One button has causesValidation="True" and the event does not fire. If I change the causesvalidation to False, the event fires.

Any help on this would be greatly appreciated.

Thanks

Do you have any validation controls on the page?!
If yes, and you wish to continue your validation set the ValidationGroup of each validation control to something, and set the ValidationGroup of your button who causes the validation to the same ValidationGroup you set for validators.

Note that CausesValidation enforce the control to validate the page, and if you set validation group, it will invoke only validators who have the same validation group.


I shall try setting the ValidationGroups and let you know.

Thanks for quick response. Appreciate it.


YES, Setting Validation Groups did the trick.

Thanks


Great,
nice to know that, good luck with the rest

Urgent! how to add the animation in update progress

coould any one tell me how to add the aninmation in update progress...this will help me alot...

<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>

<div style="margin-top:60px;">
Update is in Progress.....
</div>
</div>

</ProgressTemplate>
</asp:UpdateProgress>

You can display gif image, in a similar way as you display text e.g.

<div style="margin-top:60px;">
<img id="updateInProgressImage" src="http://pics.10026.com/?src=" alt="Update in Progress" runat="server" /> please wait...
</div>


Thanks for the reply...i have 1 question:

should i put image path in "src" or in "id"? i kept in src and it worked in IE but it won't show on firefox??

also, how can i control the font-size of the "please wait..."?

Urgent! Need a asp.net Ajax enabled TreeView control

Hi,

I need a asp.net ajax enabled TreeView control, its not a part of the AjaxControl Toolkit. I need to know where from I can get it.Please let me know if any of you have come accross a one.

Thanks in advance,

Subhadip

http://www.google.be/search?hl=nl&q=treeview+ajax&btnG=Zoeken&meta=

Lots over there ;)

Kind regards,
Wim

Urgent: AJAX. Is this possible? Thank you.

Hello,

I am creating a web site which will have a mixture of AJAX and traditional.

Basically, I want to create a web site which will be tradicional as:

1. It has a master page and a child master page.

2. It has a menu which redirects to the various pages in the web site.

And it will have a few AJAX features:

1. Authentication using AJAX

2. Use of Update Panel so that I can update some content sections in each page without refreshing the entire web page.

My questions are:

1. Should I create an AJAX web site or a traditional web site and add the script manager to it?

I already added created an AJAX web site but when I added a Master page I got an error:

"Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element.

The error was in code line "<%@dotnet.itags.org. Master Language="VB" CodeFile="MyMaster.master.vb" Inherits="MyMaster" %>" on file MyMaster.master

2. If you think I should create a traditional web site, then can I authenticate the users using AJAX?

Thank You,

Miguel

P.S: Sorry for the "Urgent" but I am completely stopped on this project and I have no idea which direction to take.




Hi,

I'm looking at similar issues in updating my website to 2.0. A couple of things from your post cought my eye. 1) I wouldn't have thought about using AJAX for authentication. As I understand AJAX it's only for client (browser) side features - that don't require a postback to the server (or limit the parts of a page that require postback). How then, can you use it for authentication? What, on the client side, can you be authenticating against?

As not all the AJAX stuff is ready for primetime, is that Ok with your plans for the website - how much pre-release bugs/changes will be Ok in your development and deployment? I'd probably be hesitant to use the CTP Codeplx stuff in a production site.

I don't see that having the website project AJAX enabled, would hurt, as it's just (I think), adding things needed to allow AJAX to work, not taking anything away from a ASP.Net 2.0 project/website.

A Bigger question might be what type of project - Website or Web Application Project (ala VS 2003 - using the add on for 2005). That's going to make a difference in your compilation scheme, and deployment issues.

For my site, I'm going to try using a single master page, but not use it for the first page, as I want that to have a unique (though compatible), style. I'll use CSS to keep things looking connected. I'm guessing - but don't know - that not having a masterpage for the default/index page will lessen the overhead a bit, and make it that much quicker to load. While broadband is ever more common, I still want a quick page for the default. With my site layout, I expect viewers to move to a content subject area, so a simple and clean fist page is Ok. It's also a place to offer an none BB, or text only , alternative. You can do this with a full feature page, but it can get very busy, and take so long to load that the point of the redirect is lost.

To go with this, I'm not sure if I'll want to use AJAX on that first page, or if having the site AJAX enabled, will not save anything by not using AJAX there. I have lots to do, and I'll check back at this post to see what others are saying about the ideas. Good luck. BRN..


Hi

I thought it doesnt really matter traditional web or AJAX web.

The only difference is AJAX web has script manager with it.

I worked with mater page with AJAX and found no trouble. The only thing you have to know is use script manager proxy for master/child page.

Cheers

MIB426

Urgent: AutoCompleteExtender doesnt work/Updatepanel doesnt work

This is my code for the AutoCompleteExtender

<asp:textboxid="txtQuickSearch"runat="server"CssClass="inputText"style="width:145px; "></asp:textbox>

<atlas:AutoCompleteExtenderrunat="server"ID="acSearch">

<atlas:AutoCompletePropertiesTargetControlID="txtQuickSearch"Enabled="True"ServicePath="http://localhost/Sony.BusinessSuite.Web.UI/AtlasServices/MasterData.asmx"ServiceMethod="GetAllModels"minimumprefixlength="2"/></atlas:AutoCompleteExtender>

When i start typing fiddler shows:

#ResultHostURLBodyCachingContent-TypeUser-defined1401localhost

/Sony.BusinessSuite.Web.UI/AtlasServices/MasterData.asmx?mn=GetAllModels

4.431text/html

The same happens with an update panel...

basically i've been trying to use atlas things in the application we are working on here for about 3 weeks now... and up until now it has been very cumbersome and time consuming.

Hi,

Could you post the code for the method you are using in your webservice

Thanks


Hi,

you are getting a 401. I believe that it happens because you are trying to access a web service in another domain and this is not allowed in normal conditions. Please checkthis thread.

Here's the webservice code, thanks in advance to have a look...

[WebService(Namespace ="http://tempuri.org/")]

[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]

[ToolboxItem(false)]

publicclassMasterdata :WebService

{

[WebMethod]

publicstring[] GetAllModels(string prefixText,int count)

{

ArrayList filteredList =newArrayList();

//Get the available product categories from the principal object.

Principal principal = (Principal)Context.User;

List<Category> myCategories = principal.Categories;

List<DKCategory> myDKCategories =newList<DKCategory>();

foreach (Category catin myCategories)

myDKCategories.Add(newDKCategory(cat.OID));

//Get the models from the masterdata service (limited to the users available categories).

Proxy.Pricing.Model.ModelService ModelSVC =new Proxy.Pricing.Model.ModelService();

List<Model> myModelsSVC = ModelSVC.GetModels(myDKCategories,null);

foreach (Model modin myModelsSVC)

{

if (mod.Name.ToLower().StartsWith(prefixText.ToLower()))

filteredList.Add(mod.Name);

}

return (string[])filteredList.ToArray(typeof(string));

}

}


Hi,

I tried the solution in the thread you suggested, but it didn't work. I don't think it is related to this though, because the webservice i'm calling is in the same project than the page consuming it.

Could the problem be related to the fact i'm using the "web application project"? or nested masterpages?

Wesley


hello.

what response do you get from fiddler?


Hi,

Have you tried using as RelativePath within your ServicePath parameter?

Regards

Urgent: Atlas breaking <asp:button> postback

On my form I have an <asp:ImageButton id='Calculate'> which calls a webservice to perform a calculation then populate a textbox.

I also have an <asp:button id='Save' test='Save'> which performs the form submit.

The Save button works correctly posting back to the server unles the Calculate button is pressed. If the Calculate button is pressed the asynchronous call for the calculation works, but afterwards the Save button will no longer postback.

I created <a href="http://links.10026.com/?link=javascript:__doPostBack('Save','')">Save it</a>. This works before the Calculate is pressed and fails after Calculate is pressed (exactly like the Save button).

Any ideas? I have a client I have to show this to in the morning.

thanks.....mac

hello.

not without seeing a small sample that reproduces the error...

urgent: Modal popup Extender is not closing after validation fires

I have an edit modalpopupextender inside the gridview that appear when linkbutton is clicked all of this inside an update panel and its working great.

when the modalpopupextender popsup i have two buttons "Close" and "Save" button and when the user click on "Close" it closes the modalpopupextender - again its working great.

but the problem isthat, when i click on "Save" button it FIRES validation and in the modalpoupextender i have twocustomvalidation controlsthat validates whether the user have check at least one checkbox or not so when the user hit on "Save" button the validation fires whic is great so far butwhen i clik on "Close" button its not closing my modalpopuextender ?

here is my close button looks like:

<ajaxToolkit:ModalPopupExtender ID="mpePerson" runat="server" TargetControlID="btnHiddenPerson"
PopupControlID="pnlPerson" OkControlID="bModalDialogCancel"CancelControlID="bModalDialogCancel" BackgroundCssClass="modalBackground"
PopupDragHandleControlID="PersonCaption">
</ajaxToolkit:ModalPopupExtender>

<asp:ButtonCausesValidation="false"ID="bModalDialogCancel" runat="server"Text=" Close "ToolTip="Close this window"/>

what is going on here?

You have your OkControlID and your CancelControlID both pointing to the same button ('bModalDialogCancel').

------------------
When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.


i fixed myself, i was passing the wrong id.

thanks.

Urgent: Serverside object is null, while calling from an Ajax script

Hi there,

I try to call a method from the an ajaxscript

Sys.Net.WebServiceProxy.invoke(this._servicePath,
this._serviceMethod,
false,
{"MethodInformation":this._MethodInformationValue},
Function.createDelegate(this,this._onMethodComplete),
Function.createDelegate(this,this._onMethodError),
this._currentCallID);
 
you cannot see it, buit these method calls a method on the serverside which is placed in
the Default.aspx.cs, I have also an table object there...
 
 
protected void Page_Load(object sender, EventArgs e)
{
CustomTableControll table =new TabelCustomControll();
...
}
 
know when I try to access the table, I get an NullPointerException...
Where is my faillure there?
Please give me some Advices... its very urgent...
 
thanks in advance,
 
Omid 

Hi Omid,

How is the method defined in the default.aspx.cs?

Are you sure that the request made by the javascript experienced a full life cycle of a normal page? That's to say, is the page_load method fired?


Hi Raymond,

first of all, thank you for your response...

that's the way I defined the method:

 [System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string executeCommand(Object[] MethodInformation)
{
Object[] obj =new Object[MethodInformation.Length - 1];
obj[0] = MethodInformation[0];
string bla = reg.execute(MethodInformation[1]as string , obj)as string;
return bla;
}

and reg.execute looks like these:

public Object execute(string methodName, Object[] args)
{
MethodCallInfo mci =null;
Object ret =null;
try {foreach (DictionaryEntry dein _hash)
{
if ((de.Keyas string).Equals(methodName))
{
mci = de.Valueas MethodCallInfo;
break;
}
}

if (mci ==null)
throw new Exception("method not Found");

Object obj = Activator.CreateInstance(mci.ClassType);
MethodInfo dynMethod = mci.ClassType.GetMethod(mci.MethodName);
if (dynMethod !=null && checkMethodInfo(dynMethod))
{
if (args !=null)
ret = dynMethod.Invoke(obj, args);
else ret = dynMethod.Invoke(obj, mci.MethodArgs); } }catch (ArgumentNullException ae)
{
Console.Error.WriteLine("Please check the MethodName.\n" + ae.StackTrace);
return null;
}
catch (TargetParameterCountException tpce)
{
Console.Error.WriteLine("Number of Parameters passed to MethodInfo.Invoke does not match the number of " +"parameters required by the method declaration. \n" + tpce.StackTrace);
return null;
}
catch (Exception e)
{
Console.Error.WriteLine("ERROR: " + e.Message +" - " + e.StackTrace);
return null;
}

return ret;
}

so as you can see i try to execute the method placed in the Derfault.aspx.cs dynamically.

the method I try to exexute is these:

public string sayHello(string ID)
{

Control c = TimeLineGrid1.FindControl(ID);// HERE I GET NULLPOINTER EXCEPTIONreturn"Hello" + ID;
}

how can I make sure to stay in a page life-cycle?

regards Omid


Omid,

Execuse me, I don't quite understand the logic in your code.

You showed 3 method here, but I don't know what's the relation between them. Can you elaborate it?


Hi Raymond,

I know the hole thing is a little bit confusing... so I try to explain it as we would debug the code.

Lets say we have a Control which produces a table

<cc3:TimeLineGrid ID="TimeLineGrid1" runat="server" OnMouseOverColumn="document.current_id = this.id;" EndTimeperiod="17:00" FixedTimeperiod=true StartTimeperiod="08:00" TimePeriod="60" EndDateTimescale="2007-06-05" FixedTimescale=true StartDateTimescale="2007-06-04"
Header="Bla Test" ShowHeader="True" OnMouseOverRow="document.current_id = this.id;" AutoPostBack="True" />
 
and the generated Row from the table looks like these:
 
<tr id="TimeLineGrid1_1" class="DEFAULT">
<td id="TimeLineGrid1_1_0" class="CARER">Omid</td>
<td id="TimeLineGrid1_1_1" colspan="10">
<div id="div_working_1_1_1" class="working" style=" width:618px; "
methodName="sayHello" onmouseover="document.current_id = this.id;" >
9:0
</div>
</td>
<td id="TimeLineGrid1_1_2" colspan="10">
<div id="div_notworking_1_2_2"
class="notworking"
style=" width:96px;float:left; "
onmouseover="document.current_id = this.id;" >
</div>
<div id="div_working_1_2_3"
class="working"
style=" width:520px;float:left; "
onmouseover="document.current_id = this.id;" >
9:0
</div>
</td>
</tr>
ok and than we have an AjaxExtender for the Control:
 
<cc2:AjaxControl4WebGridExtender ID="AjaxControl4WebGridExtender1" runat="server" TargetControlID="TimeLineGrid1"ServiceMethod="executeCommand">
</cc2:AjaxControl4WebGridExtender>
  and know the extender calls on a click event the following code:
 
populate : function(_MethodValue) {
if (this._servicePath &&this._serviceMethod) {
var m = document.getElementById(_MethodValue).attributes["methodName"].nodeValue;
alert(m);
this._MethodInformationValue =new Array(_MethodValue, m);this._CallerIDValue = _MethodValue;
Sys.Net.WebServiceProxy.invoke(this._servicePath,
this._serviceMethod,
false,
{"MethodInformation":this._MethodInformationValue},
Function.createDelegate(this,this._onMethodComplete),
Function.createDelegate(this,this._onMethodError),
this._currentCallID);
}
},
  so what I am doing upto yet is just calling a JS-method (populate) on a clickEvent,
these method reads the value ob metodName and some other information, put them together and sends them to
the server, that's all...
 
Know we are on the serverside:
 
 here the method inthis._serviceMethod is called, in our case: executeCommand, which is defined as follows:
 
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string executeCommand(Object[] MethodInformation)
{
Object[] obj =new Object[MethodInformation.Length - 1];
obj[0] = MethodInformation[0];
string bla = reg.execute(MethodInformation[1]as string , obj)as string;
return bla;
}

what the method is doing, is just calling a method dynamically and returns its return value...

in our case the executeCommand is calling the sayHello method as defined in the generated code (methodName="sayHello").

and here sayHello trys to access the control object and gets a nullpointerException...

I hope these will help both of us a littlebit out ;) ...

regards Omid


It's quite clear now.

Please note that executeCommand is a static method. And the control it tries to visit isn't instantiated, thus an exception is thrown.


sorry for my asininity,

but it's not so clear for me, what you want me to sayCrying

could you please give me a code example / or some more words ...

what I don't understand is why the table is created, but by comming back to the serverside it

doesn't exists anymore...

when I remove the static tag I get an:Web Service call failed: 500

so should I create every time I get an server side call a new Object of the Control?

regards Omid


An easier explanation is that a regular request for the page has a different life cycle to the request made by the javascript.

The control isn't created in the later situation, so can't be used.

May be you can tell me more about your requirements, then we can try to find a solution.


Hi again,

what I aim to do is, that each cell in the table, must have the possibility to execute

a different method on a specific Event (e.g. onClick) on the serverside... I think thats the

hole story Wink. That's why I wrote an Register, where the developer cann register some methods and in

the generated tag there is the method that should be executed (methodName)...

hopefully you have the ultimate solution, I'd be gladEmbarrassed

thanks for helping me so much,

Omid


And is this method able to control the layout/content of a control on the page?


My idea is that this method should be independent of the controls on the page. Any control it tries to access should be instantiate in the method itself.


Hi Raymond,

the problem is when I instantiate the control each time, then I don't / can't recreate the actual state of the control, since many things

are created by the developer from "the outside".

What do you think about a partial (asynchronous)PostBack? By the way, you know any rsources, how it works and how to implement it...

regards Omid


Omid,

If you want to make your extender user get rid of caring about the state of the control totally, you need to add a hiddenfield on the page. Save the control's state in it. And send its value to the server everytime.

Regarding your second question, I'm not quite sure what is it about. It's a little bit too common to answer. Can you be more specific?


Hi Raymond,

I decided to do it as you said, to save the state of the control in a hiddenfield:

HiddenField _hiddentbl =new HiddenField();
_hiddentbl.ID ="htbl";
_hiddentbl.Value =this._tbl;
Controls.Add(_hiddentbl);

but I get the following Errror:

Error 2 Cannot implicitly convert type 'System.Web.UI.WebControls.Table' to 'string' C:\Dokumente und Einstellungen\Administrator\Eigene Dateien\Visual Studio 2005\Projects\AJAXEnabledWebControl\TimeLineGrid\TimeLineGrid.cs 231 32 TimeLineGrid

is there a way to save the object in such a hiddenfield? do I have to override the toString() method and create a new Object from the String?

thanks,

Omid


Omid, the code you posted won't generate this error, please post the code the code in TimeLineGrid.cs. It's where the error occurred.