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

Saturday, March 24, 2012

A simples scenario using GridView + Buttons + TextBoxes

Hello!

I have a GridView and some TextBoxes to type the data (Id, Name...). I also have a button called "_btnSave". I want to add new itens to my DataSource when I click on the Save button... to do this, I've used two updatePanels: one to GridView and other to the button.

The Button UpdatePanel is used just to avoido the Button Postback...

I'd like to know if there is any way to use just the UpdatePanel of the grid. Is it possible?

Thanks

hello.

if i understood your question correctly, then i'd say that you can put everything inside an update panel...it shuold work that way...

Wednesday, March 21, 2012

A Question about Atlas client control Inheritance from Sys.UI.Select

Type.registerNamespace('Sys.UI');
Sys.UI.spxSelect = function(associatedElement) {
Sys.UI.spxSelect.initializeBase(this, [associatedElement]);
var _OnSelChange;
this.onSelChanged=this.createEvent();
this.get_selectedText = function() {
return this.element.options(this.element.selectedIndex).text;
}
this.dispose = function() {
Sys.UI.spxSelect.callBaseMethod(this, 'dispose');
}

this.getDescriptor = function() {
var td = Sys.UI.spxSelect.callBaseMethod(this, 'getDescriptor');
td.addProperty('selectedText', String,true);
return td;
}
Sys.UI.spxSelect.registerBaseMethod(this, 'getDescriptor');

this.initialize = function() {
Sys.UI.spxSelect.callBaseMethod(this, 'initialize');
_OnSelChange = Function.createDelegate(this, this.onSelChanged);
this.selectionChanged.add(_OnSelChange);

}
this.onSelChanged = function() {
this.raisePropertyChanged('selectedText');
}

}
Sys.UI.spxSelect.registerClass('Sys.UI.spxSelect', Sys.UI.Select);
Sys.TypeDescriptor.addType('script', 'spxselect', Sys.UI.spxSelect);

Why

this.onSelChanged = function() {
this.raisePropertyChanged('selectedText');
}

can't run after raise selectionChanged

Hi,

you have declared onSelChanged to be both an event:

this.onSelChanged=this.createEvent();

and a function:

this.onSelChanged = function() {

I think that removing the event declaration should fix it.


I fix it ,but it's have the same question


I have also found that if you inherit from an Atlas control, for example, Sys.UI.Button, and implement the initialize() method, the initialize() method of Sys.UI.Button does NOT get invoked because the initialize() method of Sys.UI.Button isn't registered as a BaseMethod. My question is: why not? Can anyone from the Atlas team please explain.

tzkuei


in yuor this.getDescriptor = function() {}

add line

td.addEvent('onSelChanged', true);

to register the event


Xiyuan Shen:

in yuor this.getDescriptor = function() {}

add line

td.addEvent('onSelChanged', true);

to register the event

Sys.UI.Select:

this._onSelectionChanged = function() {
this.raisePropertyChanged('selectedValue');
this.selectionChanged.invoke(this, Sys.EventArgs.Empty);
}

My Select:

var _OnSelChange;

this.initialize = function() {
Sys.UI.spxSelect.callBaseMethod(this, 'initialize');
_OnSelChange = Function.createDelegate(this, this.onSelChanged);
this.selectionChanged.add(_OnSelChange);

}
this.onSelChanged = function() {
this.raisePropertyChanged('selectedText');
}

Sorry,My question is how I can captureSelect.selectionChanged event in my select controlonSelChanged


The initialize() method of Sys.UI.Select is NOT invoked by Sys.UI.spxSelect.callBaseMethod(this, 'initialize'); therefore the onchange event is not hooked up.

I have raised this point in my post here: http://forums.asp.net/thread/1250969.aspx


if inseted line in my previous post to you getDescriptor function, then the syntax for the markup sholud look like this

<spxselect id="XXX"onSelChanged="youreventhandlerhere" ...>

</spxselect>

please notice that the name of prpoerty (red highlighted) is defiend by the line i posted for you.

A circular reference was detected while serializing an object of type "System.goblaization

Hi all,

I am trying to call a webservice through javascript to return a dataset to bind it to a datagrid on the client side.

I am using a scriptmanager and registered the service by setting the service path.

I am calling a method on a Textbox onKeydown event to call the webservice method. The web service is returning the a data set. But the problem is am geting an exception stating the following

The server method 'GetDataSet' failed with the following error: System.InvalidOperationException-- A Circular reference was detected while serializing an object of type "System.Globalization.CultureInfo"

Please help me out.

See the following code to get an idea about the problem i have

<WebMethod(EnableSession:=True)> _

PublicFunction GetDataSet(ByVal prefixTextAsString)As DataSet

Dim dtAs DataTable

dt =New DataTable

Dim drAs DataRow

dt =Me.GetSelectedTestSchema()

dr =Me.PopulateSelectedTestsRow("1020","dafda", dt)

Try

dt.Rows.Add(dr)

Catch exAs Exception

EndTry

Dim dsAs DataSet =New DataSet()

ds.Tables.Add(dt)

Return ds

EndFunction

Javascript code

function GenerateGrid()

{

var myGrid = igtbl_getGridById("grdSelectedTests");

TestListService.GetDataSet("x",OnWebRequestComplete);

// myGrid.Control.Set_DataDataSource(TestListService.GetDataSet("x").Table[0]);

//

}

function OnWebRequestComplete(results)

{

'I am using the Infragistics ultraWebgrid

var grdControl = igtbl_getGridById("grdSelectedTests");

grdControl.control.set_data(results);

}

Scriptmanager code

<asp:ScriptManagerID="ScriptManager1"runat="server">

<Services>

<asp:ServiceReferencePath="../AutoCompleteServices/TestListService.asmx"/>

</Services>

</asp:ScriptManager>

Hi,

According to my understanding to your problem, I don't think it's a AJAX specific issue. The exception is related to your server side code.

Can you debug your server side code to try to solve it?

Or you may post the code for methods:GetSelectedTestSchema() andPopulateSelectedTestsRow here.


We are marking this issue as "Answered". If you have any new findings or concerns, please feel free to unmark the issue.


I too am having the same problems.

I'm using C# to write my webservice, I have almost an identical setup for the client-side scripts.


I get this error even when returning an empty DataSet.


 [WebMethod]public DataSet GetData() {return new DataSet(); }

Does anyone know what this error message is telling me? I tried debugging it, and no exception is thrown from the webservice and it works fine when I send a soap request to it.

Thanks,

Lee


You may try to overcome it by setting response format to XML. For instance:

[System.Web.Script.Services.ScriptMethod(ResponseFormat=System.Web.Script.Services.ResponseFormat.Xml)]
public DataSet GetData()
{

A Circular Reference Was Detected error

Hi there,

This has been confusing me to no ends for the past weekend and I ask for your help. When I try to access an IList of Type <SampleRow> or any list structure for that matter, I get this:

A circular reference was detected while serializing an object of type ...<- Many types have popped up (System.Reflection.Module) for example.

I've been trying to run the samples in the documentation with no more success (same error). I'm thinking this has to do with some libraries loaded and not the code itself. I have looked in the GAC, uninstalled/reinstalled everything from VS2005 to the ATLAS Framework (even IIS) with no go. I need to get the list structure for the listview control of ATLAS. It this can help, I'm pasting the stacktrace. Also, I'm not sure this is a specific ATLAS error but I can't tell otherwise. Thanks for your help. If you need anything more, please ask.Smile

[InvalidOperationException: A circular reference was detected while serializing an object of type 'System.Reflection.Module'.]
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValueInternal(Object o) +766
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValue(Object o) +90
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeCustomObject(Object o) +706
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValueInternal(Object o) +908
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValue(Object o) +90
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeCustomObject(Object o) +706
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValueInternal(Object o) +908
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValue(Object o) +90
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeCustomObject(Object o) +706
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValueInternal(Object o) +908
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValue(Object o) +90
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeCustomObject(Object o) +706
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValueInternal(Object o) +908
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValue(Object o) +90
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeEnumerable(IEnumerable enumerable) +159
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValueInternal(Object o) +874
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValue(Object o) +90
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeCustomObject(Object o) +706
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValueInternal(Object o) +908
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.SerializeValue(Object o) +90
Microsoft.Web.Script.Serialization.JavaScriptObjectSerializer.Serialize(Object o, IJavaScriptSerializationContext context) +62
Microsoft.Web.UI.Controls.InitialData.GetDataServiceResult() +589
Microsoft.Web.UI.Controls.InitialData.RenderScript(ScriptTextWriter writer) +248
Microsoft.Web.UI.Controls.InitialData.Microsoft.Web.Script.IScriptObject.RenderScript(ScriptTextWriter writer) +31
Microsoft.Web.UI.ScriptManager.RenderXmlScript(TextWriter writer) +735
Microsoft.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +663
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +96
System.Web.UI.Page.PerformPreRenderComplete() +32
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +479

Lesson learned: commenting the web.config file temporarily and forgetting about it is a bad idea. I had the converters section commented out, re-enabling them solved the problem. If it can help anyone to learn from my mistake then I won't have posted in vain!

Thanks.