PDA

View Full Version : Hassles with asp.net button



gokujames
1 Sep 2010, 9:22 PM
I tried searching the forums before i started the post :D (good boy ain't i ) .So to test out i added a server button control to the west region and wrote some server code to change the buttons text, but sadly :(( button does not postback. below is my code:


Ext.onReady(function(){
var myBorderPanel = new Ext.Panel({
renderTo: document.body,
width: 1280,
height:830,
title: 'Border Layout',
layout: 'border',
items: [{
title: 'South Region is resizable',
region: 'south', // position for region
height: 100,
collapsible: true, // make collapsible
split: true, // enable resizing
minSize: 75, // defaults to 50
maxSize: 150,
margins: '0 5 5 5'
},{
// xtype: 'panel' implied by default
title: 'West Region is collapsible',
region:"west",
contentEl:'div1',
margins: '5 0 0 5',
width: 200,
collapsible: true, // make collapsible
cmargins: '5 5 0 5', // adjust top margin when collapsed
id: 'west-region-container',
layout: 'fit'
},{
title: 'Center Region',
region: 'center', // center region is required, no width/height specified
xtype: 'container',
layout: 'fit',
margins: '5 5 0 0'
},{
title: 'East Region',
region: 'east',
width:200,
split:true,
collapsible:true,
layout: 'fit',
margins: '5 5 0 0'
}]
});

and here is my div1 from which the content is loaded for west region,

<div id="div1">
<asp:Button id="foo" runat="server" text="who is chuckie" onclick="foo_Click" />
</div>

my code behind:

protected void foo_Click(object sender, EventArgs e)
{
foo.Text = "Now you have clicked";
}
So is Ajax the only solution to this ?
Can't i use the server controls in a border-layout?
Now we go on for a ride, awaiting your answers

Animal
1 Sep 2010, 9:30 PM
"content loaded"???

So you throw dead innerHTML into the west region instead of creating Components? Why don't you create Components?

gokujames
1 Sep 2010, 9:38 PM
"content loaded"???
So you throw dead innerHTML into the west region instead of creating Components? Why don't you create Components?

I don't get you :( or I might be bit dumb :) . Yes the content seems to be loaded.I have a button put into a west region and it is collapsible. Innerhtml should give you the button's markUp should'nt it?
here is a pic,
http://deeptechtons.net/images/pic.png

I think it would be better if you can give me some Code to work with, The layout documentation is too much for me to handle at a time

Animal
1 Sep 2010, 9:42 PM
Want a button there?



Ext.onReady(function(){
var myBorderPanel = new Ext.Panel({
renderTo: document.body,
width: 1280,
height:830,
title: 'Border Layout',
layout: 'border',
items: [{
title: 'South Region is resizable',
region: 'south', // position for region
height: 100,
collapsible: true, // make collapsible
split: true, // enable resizing
minSize: 75, // defaults to 50
maxSize: 150,
margins: '0 5 5 5'
},{
// xtype: 'panel' implied by default
title: 'West Region is collapsible',
region:"west",
items: [{
xtype: 'button',
text: 'An Ext Button',
handler: foo_Click
}],
margins: '5 0 0 5',
width: 200,
collapsible: true, // make collapsible
cmargins: '5 5 0 5', // adjust top margin when collapsed
id: 'west-region-container',
layout: 'fit'
},{
title: 'Center Region',
region: 'center', // center region is required, no width/height specified
xtype: 'container',
layout: 'fit',
margins: '5 5 0 0'
},{
title: 'East Region',
region: 'east',
width:200,
split:true,
collapsible:true,
layout: 'fit',
margins: '5 5 0 0'
}]
});

If you are writing a new app, start in the best way: Use NO textual HTML at all.

gokujames
1 Sep 2010, 9:55 PM
I am spell bound, thanks for the code :D
So now i will be writing , foo_click function, handler for the button am i right !!
So does this mean, I will not be able to use the .NET Asp.net server control along with ExtJs ?

Animal
1 Sep 2010, 11:24 PM
Why would you want to?

gokujames
2 Sep 2010, 12:11 AM
well the primary reason would be to cut down Learning time.Secondly i have extensively used ASp.NET grids and sql datassource controls + etc for the project.I don't want to go back and replace my whole thing again with Extjs Grid and DataStore and all the json stuff.
Hope you are getting my point ;D

Animal
2 Sep 2010, 1:59 AM
You will learn at some time anyway.

And if you continue to shoehorn inapropriate HTML into Ext Components, then at that future time at which you finally learn, you will slap your head, and have to undo <n> months work of work.

Best bet is to learn right now, and do things right first. It will save time in the long run.

gokujames
2 Sep 2010, 2:05 AM
Sure i do agree you :D, but just wanted to know if there was a way to integrate asp.net controls with Extjs that's all.
Thanks for your opinion Animal +rep

Animal
2 Sep 2010, 3:13 AM
There are people here who know about that. Try doing a search for asp.net in the forum.