|
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
|
|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
InitialState is the best way to do it.
Thanks
|
|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
This is a more sophisticated way. :) Thanks for sharing!
|
|
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
|
|
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; }
........ }
|
|
Rank: Advanced Member Groups: Member
Joined: 4/4/2008 Posts: 46
|
Thanks a bunch... I'll give it a try!!
|
|