Welcome Guest Search | Active Topics | Sign In | Register

Show Dialog from CodeBehind Options
Dave
Posted: Wednesday, April 9, 2008 11:54:15 AM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Hey guys,

Is there a better way to do this:

protected void Page_Load(object sender, EventArgs e)
{
dlgErrSelectRow.InitialState = EO.Web.DialogState.Hidden;

.........
}

protected void btnSelect_Click(object sender, EventArgs e)
{
if (employeeGrid.SelectedItemIndex < 0)
{
dlgErrSelectRow.InitialState = EO.Web.DialogState.Visible;
return;
}

........
}

This results in a PostBack, the Page is rendered all over again and then the Dialog appears. I'd prefer not to have the Dialog behave the same as if if were tied to a "ShowButton" but I need to do it in the codebehind when "btnSelect" is clicked and the only when

if (employeeGrid.SelectedItemIndex < 0)

is true.

Thanks in advance.....

Dave
Dave
Posted: Wednesday, April 9, 2008 11:56:15 AM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Let me correct.....

I'd prefer to have the Dialog behave the same as if if were tied to a "ShowButton" but I need to do it in the codebehind when "btnSelect" is clicked and the only when
eo_support
Posted: Wednesday, April 9, 2008 12:09:28 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,093
Hi,

InitialState is the best way to do it.

Thanks
exorgroup
Posted: Thursday, April 10, 2008 3:07:13 PM
Rank: Member
Groups: Member

Joined: 12/18/2007
Posts: 20
We had the same problem and solved it by registering some javascript from code behind after setting the contents

Code below is in vb.net and is able to pop the message box:
Dim script As String = "javascript:eo_GetObject('errMsg').show(true);"
ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), "ErrorScript", script, True)

Hope it works for you too
Duncan
eo_support
Posted: Thursday, April 10, 2008 3:09:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,093
This is a more sophisticated way. :) Thanks for sharing!
Dave
Posted: Thursday, April 10, 2008 3:28:30 PM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
exorgroup wrote:
We had the same problem and solved it by registering some javascript from code behind after setting the contents

Code below is in vb.net and is able to pop the message box:
Dim script As String = "javascript:eo_GetObject('errMsg').show(true);"
ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), "ErrorScript", script, True)

Hope it works for you too
Duncan


Guess I'm being dense..... Once I register the script, how do I call it from my ButtonClick code in the codebehind and avoid the postback???

The current code is:

protected void btnSelect_Click(object sender, EventArgs e)
{
if (employeeGrid.SelectedItemIndex < 0)
{
dlgErrGrid.InitialState = EO.Web.DialogState.Visible;

return;
}
.....
.....
.....
}

Thanks in advance....

Dave
exorgroup
Posted: Friday, April 11, 2008 1:44:21 AM
Rank: Member
Groups: Member

Joined: 12/18/2007
Posts: 20
so from what I can understand you want to pop the dialog when btnSelect is clicked and employeeGrid.SelectedItemIndex < 0

protected void btnSelect_Click(object sender, EventArgs e)
{
if (employeeGrid.SelectedItemIndex < 0)
{
// old call
//dlgErrSelectRow.InitialState = EO.Web.DialogState.Visible;

//new call - need to be translated to C# from VB
//Dim script As String = "javascript:eo_GetObject('errMsg').show(true);"
//ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), "ErrorScript", script, True)

//ScriptManager is used if using Ms AJAX - if not than use Page.RegisterClientScriptBlock(GetType(Page), "ErrorScript", script, True)

return;
}

........
}
Dave
Posted: Friday, April 11, 2008 4:50:35 AM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Thanks a bunch... I'll give it a try!!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.