ラベル value の投稿を表示しています。 すべての投稿を表示
ラベル value の投稿を表示しています。 すべての投稿を表示

2012年3月28日水曜日

Reset controls in update panel when error is thrown

Hello fellow developers,

A user enters a value in a textbox and i click a button to get some data, but a server error is thrown.

Is there a way to clear/reset the textbox in an UpdatePanel when there is a server error?

If there is a way, can someone assist in providing me that trick?

Thanks in Advance.

Protected Sub myButton_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles myButton.Click
Try
' Whatever code that I'm trying to run goes here.
' This is the code that my produce the error.
Catch
myTextbox.Text =""
End Try
End Sub


Can't you simply use a try/catch block, and catch the exception? If an exception is thrown reset it to the old value. You can use a hidden label or textbox to store the previous value.


Use this

protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{
if (condition)
{
ScriptManager1.AsyncPostBackErrorMessage =
e.Exception.Message;

}
else
{
ScriptManager1.AsyncPostBackErrorMessage =
"An unspecified error occurred.";
}
}


I apologize. My example scenario was not explained the way I originally thought.

The example should be that when using AJAX you want to show an error message AND reset the controls.

If you write code to 'Throw' a custom error message to an alert window, nothing after the 'Throw' gets executed (clearing my textbox).

So my question really should be:

Is there a way, using AJAX, to 'Throw' a custom error message to an alert window and still reset controls? Either on the server or client side.

Thanks.


Protected Sub myButton_Click(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles myButton.Click
Try
' Whatever code that I'm trying to run goes here.
' This is the code that my produce the error.
Catch exAs Exception
ScriptManager.RegisterStartupScript(Page, Page.GetType,"ErrorMsg", "alert('" & ex.Message & "');",True)
myTextbox.Text =""
End Try
End Sub


Thanks Buddha, that's just what I needed.

2012年3月26日月曜日

Restrict slider from moving past maximum value

Hi,

I am very new to the ajaxcontrol toolkit. I need to implement a slider for one of my projects at school. I created a simple <sliderextender> and bound it to a textbox as shown in the example. For some reason, when I run it, the slider is able to slide past the maximum value and keeps sliding. Anyone seen this before? Below is the code:

<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:TextBox ID="slider1" runat="server" />
<asp:TextBox id="sliderbound1" runat="server" Width="30" />
<cc1:SliderExtender ID="SliderExtender1"
runat="server"
Minimum="0" Maximum="100" EnableHandleAnimation="true"
Orientation="Horizontal" TargetControlID="slider1" BoundControlID="sliderbound1">
</cc1:SliderExtender>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Hi,

the reason is an old issue whose fix has not been yet propagated to the release branch :(

If you download one of the latest development branch from here, the issue should be resolved.

If you have downloaded the source code for the latest release:

1. Go to Slider/SliderBehavior.js

2. Find this line (lineno 323 in my file): this._handleAnimation = new $AA.LengthAnimation( ...

3. Replace $AA with: AjaxControlToolkit.Animation

4. Recompile the source code


Hi Garbin,

Thanks a bunch, the fix worked like a charm :)

Thanks,

Praveen


Retrieve value from a dynamically created control inside an UpadetPanel

I would like to dynamically create some controls - tablecells, textboxes, and dropdownlists inside an AJAX UpdatePanel.
How would I retrieve the values that user enters into these controls in my vb.net code behind?
Can you please provide vb.net sample code ??

Here is my code:

'creates the textboxes - works fine

For i = 1 To intUnseatedGuestCount
Dim txtFirstName As New TextBox
txtFirstName.ID = "txtFirstName" + i.ToString
Me.tdNewSeatingCards.Controls.Add(txtFirstName)
Next

'code to retreive the values - produces an error message

Object reference not set to an instance of an object

For i = 1 To Me.hidNewSeatingCardCount.value
strTXTName = "txtFirstName" + i.ToString
Dim myTXT As TextBox = CType(Me.tdNewSeatingCards.FindControl("txtFirstName" + i.ToString), TextBox)
strTest += myTXT.Text + "<br>"
Next

Thank you for your help

You are creating controls dynamically, So on every postback (even in asynchronous postbacks ) you have to create it


OK Here is my code to recreate the controls:

For i = 1 To Me.hidNewSeatingCardCount.Value
Dim txtFirstName As TextBox = CType(Me.tdNewSeatingCards.FindControl("txtFirstName" + i.ToString), TextBox)
txtFirstName.ID = "txtFirstName" + i.ToString
Me.tdNewSeatingCards.Controls.Add(txtFirstName)
strTest += CType(Me.tdNewSeatingCards.FindControl("txtFirstName" + i.ToString), TextBox).Text
Next

There are no error messages, but I am not getting the values that the user enters into the textbox.

Thank you


Hi,

Thank you for your post!

You should place your recreate code in the init event.

The cause of the issue is viewstate process is finished before you recreate your controls!

If you have further questions,let me know!

Best Regards,

retrieve value from a dynamically created control

I would like dynamically create some controls - tablecells, textboxes, and dropdownlists inside an AJAX UpdatePanel.

How would I retrieve the values that user enters into these controls in my vb.net code behind?

Can you please provide vb.net sample code ??

Thank you for your help

http://forums.devx.com/showthread.php?t=16770

http://mail.123aspx.com/ArticleFrame.aspx?res=31558


here is a nice tutorial with example / code on how to create Dynamic controls and how to retrieve values from these dynamic controls.. [Page_Init() event is used here...]

SingingEels : Dynamically Created Controls in ASP.NET

hope it helps./.

2012年3月24日土曜日

Returning results from a page method call

In my ASP.NET AJAX web site, I am attempting to use Page Methods to return data from the web server. I would like to be able to return the value from a page method like so:

function GetValue()
{
return PageMethods.GetValueFromServer();
}

function ManipulateValue()
{
var myValue = GetValue();

// Do something with myValue
}

Unfortunately, calling a page method requires the use of a callback function. I really need to retrieve the value without having to store it in a global variable in the callback function; is there any way to do this?

function GetValue(){ return PageMethods.GetValueFromServer( function(result){// The result that is returned from server //Now do what ever you would like to do.} );}
Maybe you can try something like this

KaziManzurRashid:

function GetValue()
{
return PageMethods.GetValueFromServer(

function(result)
{
return result;
}

);
}

Maybe you can try something like this


I tried your code, returning the result in the nested callback function (see above), but when I returned to the code that calls GetValue() the value that ends up getting returned is undefined. :-(


Yes that becasue the ajax call is async. it does not wait for the ajax call to complete, why do not you call the GetValue in the Callback?


KaziManzurRashid:

Yes that becasue the ajax call is async. it does not wait for the ajax call to complete,why do not you call the GetValue in the Callback?



Okay, I'm somewhat confused. I call GetValue(), which calls an asynchronous server method and is passed an in-line Javascript callback function. Are you saying that I should, in the callback function, call GetValue() again? If so, won't that just cause an infinite loop?


Sorry let me rephrase. You do not need to call the GetValue again in the callback although doing it will not make it recursive. You can call your desired outer ManipulateValue function in the callback but in that case the ManipulateValue will not again call the GetValue.


KaziManzurRashid:

Sorry let me rephrase. You do not need to call the GetValue again in the callback although doing it will not make it recursive. You can call your desired outer ManipulateValue function in the callback but in that case the ManipulateValue will not again call the GetValue.

Okay, I tried that but still no luck. Here is the code I am using; perhaps you can shed some insight on to what I'm doing wrong? It looks like this is, in fact, causing an infinite loop.

Javascript code:

function PrintDateTime()
{
var dateTimeFromServer = RetrieveDateTime();
$get("myLabel").innerHTML = dateTimeFromServer;
}

function RetrieveDateTime();
{
return GetAjaxValue();
}

function GetAjaxValue()
{
return PageMethods.GetCurrentDateTime(
function (result)
{
return RetrieveDateTime();
}
);
}

C# code:

[WebMethod]
public static string GetCurrentDateTime()
{
return DateTime.Now.ToString();
}


You can do it in the following way:

function GetAjaxValue(){ return PageMethods.GetCurrentDateTime( function (result) { $get("myLabel").innerHTML = result; } );} function showCurrentDateTime(){GetAjaxValue();}

Just call the showCurrentDateTime in your code when you want to show it.


KaziManzurRashid:

You can do it in the following way:

function GetAjaxValue()
{
return PageMethods.GetCurrentDateTime(
function (result)
{
$get("myLabel").innerHTML = result;
}
);
}
function showCurrentDateTime()
{
GetAjaxValue();
}

Just call the showCurrentDateTime in your code when you want to show it.

Thanks for the time you've spent addressing my questions, Kazi. Unfortunately, in my code I really need to return the value in the RetrieveDateTime() function. The code in PrintDateTime() is just used for illustration; I need to do more than just put it in a label. To clarify, here's exactly what I want to do:

var myValue = RetrieveDateTime();

The value is not being displayed on screen but is being used by logic within a JavaScript function. I really just want to be able to call a JavaScipt function and return a value that I can use in the rest of the code.


Hi, Well you have to undertand the nature, it is always. and thats why the best place to assume the value is availabe is the Callback. If you can describe more of your scenerio then I can help.


Hi,

Thank you for your post!

It seems that you have misunderstanding on AJAX and callback.

The result cann't be obtained like this:

var myValue = GetValue();

It must be obtained like this:

function SetSessionValue(key, value)
{
PageMethods.SetSessionValue(key, value,
OnSucceeded, OnFailed);
}

// Callback function invoked on successful
// completion of the page method.
function OnSucceeded(result, userContext, methodName)
{
if (methodName == "GetSessionValue")
{
displayElement.innerHTML = "Current session state value: " +
result;
}
}

// Callback function invoked on failure
// of the page method.
function OnFailed(error, userContext, methodName)
{
if(error !== null)
{
displayElement.innerHTML = "An error occurred: " +
error.get_message();
}
}

For more information about callback and webmethod, seehttp://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx

If you have further questions,let me know.

Best Regards,

Returning selected value from ModalPopup in a custom web control

I'm a little lost on how to do this conceptually -- can someone perhaps shed a little light on how this might be done?

    Custom web control consists of UpdatePanel with other UI controls and a ModalPopupExtender. The purpose is to be a reusable search popup, and I've got the search UI functionality working like a champ.

    Page with an UpdatePanel containing some container (textbox, listbox, label, etc), a linkbutton, and my custom control from #1.

What I would like to do is have the linkbutton call some script (be it client- or server-side, not sure what's the most appropriate yet) that does the following steps:

    Show the custom popup

    Allow the user to perform the search and select one of the results, which would close the popup

    Snag the selected value from my popup, then work with that value to update the container (i.e. if it's a listbox, then do some script to insert an appropriate item)

How can I pull this one off, so the search popup is an isolated, reusable control? I've got different instances where I need the selected value to change a Label, update a TextBox, or even be inserted in a ListBox. I've got plenty of public properties on the custom control already that determines the parameters for the search itself; is there a perhaps way to override the Show() method so that it would return the value of the selection after it closes? But since Show() wouldn't really block, I'm lost on how to do it.

Thanks a lot,
Jon

Am I screwed on this one? The best I've been able to get are two separate custom controls with a LOT of duplicated code ...

Control contents: Listbox, linkbutton to show popup, all the popup code

Then repeat with a new control replacing the Listbox with a Label etc ...

I hate having this much duplicated code; anytime I need to change the popup code I'll have to duplicate it in each of my custom controls. There has to be a better way to do this?!?


I am not sure if i understand you question 100% from what ive read but if you want to get a value return from the mod popup is should not be to hard.

Lets say i have a mod popup that has a textbox, a search button, a listbox of results and a submit button. What you could do is once you have run the search which you said is working great, display the results in the listbox in the popup. then when the user clicks the submit button an event is fired that checks to see if they selected one of the items in the list box, if not then it will tell them to do so. Then if you want to use that selected value to populate a listbox on the main for (say for example you searched in the popup for a street name and then selected the right street name from the listbox and clicked submit and you want the main form listbox to display all people on that street) then all you need to do is have the event for the submit button Click call a function you write that runs the query to get all people on that street and print their info the the list box.

It should not be hard to get the results from the popup, but im not sure i understand what you are asking so this could be no help at all :P


Well! There's a little different between the concept of Modal Popup in Windows and Web forms. The latter is just hiding all the controls in the Popup and show when needed but you should able to access the properties of those controls within the scope of the page.

Now, assuming that you want to create a ASP.NET reusable custom server control that "know-how" to popup a modal to collect data from the end-user. The basic class design can be used so you just have to declare a public property so that it can return the selected value. Another alternative is you can use a Session key to store the value so that the class container can retrieve after using your class. This key can be set as a property of your class prior to the container is using it.

I hope it help since your question left a lot of detail out hence it's not very clear.


My apologies for not being clear enough -- I think I wrote the initial post after too much coffee and a bit too much frustration. :(

The overall project is an admin web UI for AD objects, so popup searches are going to be very common. Some pages will have multiple popup searches, so it is my desire to completely wrap all of that functionality into a single reusable custom server control. The results of the search could be used to update different types of UI elements on the parent page; my struggle is with conceptually figuring out where the pieces go to make this work in more than one situation.

My custom control now is an UpdatePanel with all the search UI and tidbits inside, and a ModalPopupExtender. There are many public properties on my control, mostly to define how the search itself is going to work. TargetControlID for the extender is also exposed as a public property, so that I can wire the popup to any UI element on the parent page that I want. The control also has a hidden element in it; this hidden element eventually contains the selection the user chose from the search results and is exposed via a public "SelectedResult" property.

Everything up to this point is working 100%. I'm stuck, however, on implementing the hooks for getting the value back to the parent page. Once someone clicks the TargetControl and performs the search and selects a result (which then hides the popup through server script in the control itself), the result is stored in the hidden element and the user is back at the parent page. But how do I work with that SelectedResult then? I should be able to, once the popup is hidden, take that value and stick it somewhere on the parent page -- but apparently I'm missing something obvious, because I'm completely lost.

Do I handle it via a custom click event for the wired target (instead of just using TargetControlID)? Does OnOKScript fit in here somewhere? Since the activity to take place after a selection is made will be different depending on the situation, it needs to happen outside of my custom control. Are there additional extender props that I need to expose through a public property on my custom control?

I hope this helps -- I'm not seeking exact code samples, I'm more looking for help on getting my brain wrapped around the "how" of the solution ... the exact code I should be able to figure out after that, I think. If some of my code for certain parts would help, I'll be happy to post them -- just let me know. Thanks again!


Alright so im still not sure if this is anything helpful, but i have a small example here i wrote of what i would do to put the result from my modal popup into my main page and from there i could do what ever i want with it. I tried to comment the best i could to make it super easy to read

using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using AjaxControlToolkit;public partialclass administration_OIS_Default : System.Web.UI.Page{ ModalPopupExtender modPop =new ModalPopupExtender();//The main modal popupprotected void Page_Load(object sender, EventArgs e) { HiddenField results =new HiddenField();//Results from mod popup HiddenField hidden =new HiddenField();//Mod popup targetID UpdatePanel update =new UpdatePanel();//UpdatePanel to hold controls TextBox tempText =new TextBox();//Textbox for mod popup Button btnVisible =new Button();//Button to show mod popup Button btnSubmit =new Button();//Submit button in mod popup Panel container =new Panel();//Panel to hold controls for mod popup //Assign IDs to variables that need to be refrenced later container.ID ="Container1"; results.ID ="Result1"; hidden.ID ="Hidden1"; btnVisible.Text ="Click to show modPop"; btnVisible.ID ="visibleButton"; btnVisible.Click +=new EventHandler(this.btnVisible_Click);//Tell the button what do do when click update.ContentTemplateContainer.Controls.Add(btnVisible);//Add the button to main update panel update.UpdateMode = UpdatePanelUpdateMode.Conditional;//We only want the panel to update sometimes update.ChildrenAsTriggers =true;//IE. when child controls trigger it update.ContentTemplateContainer.Controls.Add(hidden);//Add "hidden" to the update panel tempText.ID ="textBoxTest";//Add a simple textbox to the control container.Controls.Add(tempText);//container to be placed in our modal popup btnSubmit.Text ="btnSubmit"; btnSubmit.ID ="btnSubmit1"; btnSubmit.Click +=new EventHandler(this.btnSubmit_Click);//tell submit what to do when clicked container.Controls.Add(btnSubmit);//and add it to our control container modPop.TargetControlID = hidden.ID;//We would rather use modpopup.Show() so we make this a hidden field modPop.PopupControlID = container.ID;//Define the object to be shown inside of mod popup modPop.DropShadow =true;//Why not a little style :P modPop.X = 500; modPop.Y = 250; update.ContentTemplateContainer.Controls.Add(modPop);//Add the modal popup to our update panel update.ContentTemplateContainer.Controls.Add(results);//Add our results holder to the update panel update.ContentTemplateContainer.Controls.Add(container);//Also add the modal popup contents form1.Controls.Add(update);//Add our updatepanel to the main form }/// <summary> /// Function will force the modalPopup extender function .Show to fire /// </summary>private void btnVisible_Click(object sender, EventArgs e) { modPop.Show(); }/// <summary> /// Function takes the users input from the modal popup and saves it to a hidden field /// located in the updatepanel so that it will be save for further use /// </summary>private void btnSubmit_Click(object sender, EventArgs e) { ((HiddenField)form1.FindControl("Result1")).Value = ((TextBox)((Button)sender).Parent.Controls[0]).Text; }/// <summary> /// Function will display the saved value from the modal popup to prove that it works /// </summary>private void showText() { txtOutput.Text = ((HiddenField)form1.FindControl("Result1")).Value; }/// <summary> /// Occurs when button1 is clicked, showing the save results from modal popup /// </summary>protected void Button1_Click(object sender, EventArgs e) { showText(); }}
 So basically the user will click a button here to show the modal popup. enter text and click submit in the modal popup, and then they are brought back to the main form where if they click on Button1,
the value that they entered into the modal popup will be displayed. I got lazy at the end and didnt add txtOutput or Button1 programmatically so if you want to run this code on your own i think those are
the only 2 things you will have to manuall add to the form
Enjoy

You know what, I think I've got it ... maybe I just needed to "air it out" and let my mind wander for a bit. Seems like it would be simple after all, let me know if I'm off base:

I could just have the custom control expose another public property, and the parent page sets that property to a hidden control on the PARENT PAGE. Then the custom server control sets that hidden control's value before calling hide(). The hidden control on the parent page would have an onChanged() event that could do whatever UI update activity is necessary. That would keep all of the code separate from the custom control, allowing it to work in any situation I needed.

I'm going to try that right now ... if it is indeed this simple, my apologies for going around in circles on this one Embarrassed


Sounds like your on the right track now, well at least the track that I felt is what would help you get to where you want to go. and yeah, sometimes its best to take your mind of things then come back with a different perspective, or go onto forums like this and let someone else share their point of view, it saves a lot of frusterationSmile


It actually turns out to be even simpler -- I just need my custom control to raise a public event when the user selects a search result, and passes the selection as part of the args. The consuming page just watches for that event and does whatever UI magic is necessary as a result. No hidden fields or other stuff in the middle.

Amazing how much clearer things get after talking it out. Thank you everyone for your help and patience -- I'll try to make this control available publicly shortly and post a link in this thread; your help has been invaluable!


invaluable, wow i feel specialBig Smile


Can you please give some example on how the modal popuo raises a public event and how the parent page watches for the event? Thanks.

jmbutler:

It actually turns out to be even simpler -- I just need my custom control to raise a public event when the user selects a search result, and passes the selection as part of the args. The consuming page just watches for that event and does whatever UI magic is necessary as a result. No hidden fields or other stuff in the middle.

Amazing how much clearer things get after talking it out. Thank you everyone for your help and patience -- I'll try to make this control available publicly shortly and post a link in this thread; your help has been invaluable!


Sure thing!

My ModalPopup is completely contained in a custom web control, so in that control's code I've first defined the custom event that I will raise, including a custom derived EventArgs class that will include the information about which search result the user selected:

public delegate void ResultSelectedEventHandler(object sender, SelectedEventArgs e);public event ResultSelectedEventHandler ResultSelected;public class SelectedEventArgs : EventArgs {public string Selection;public SelectedEventArgs(string selection) {this.Selection = selection; } }protected virtual void OnResultSelected(SelectedEventArgs e) {if (ResultSelected !=null) ResultSelected(this, e); }

Then in the click code for my selection button, I raise this event before hiding the popup ("RadioSelect" is a radio button from my search panel's GridView; it's value is a two-dimensional string array separated by '|'):

protected void lnkAddSelected_Click(object sender, EventArgs e) {// raise an event to notify the consuming page that a selection was made OnResultSelected(new SelectedEventArgs(Request.Form["RadioSelect"]));// we're done; close the popup ModalPopupExtender1.Hide(); }

Now, back on the consuming parent page, I subscribe to this event in the markup of my custom control (note I've exposed TargetControlID publicly as well so I can wire my custom control to anything I want):

<uc2:PopupADSearch ID="PrimaryOwner" runat="server" TargetControlID="lnkChangePrimaryOwner" OnResultSelected="PrimaryOwner_Selected" />

Finally, in the code for my parent page, I define the PrimaryOwner_Selected method:

protected void PrimaryOwner_Selected(object sender, PopupADSearch.SelectedEventArgs e) {string[] selection = e.Selection.Split('|'); hidPrimaryOwner.Value = selection[0]; lblPrimaryOwner.Text = selection[1]; }

It's also important to note that the custom control, hidPrimaryOwner (a hidden control), and lblPrimaryOwner (a typical label server control) are all within an UpdatePanel -- otherwise all this jazz wouldn't work without a full-page postback. Hope you find this useful!


Hi,

From this post, I felt that you guys h've worked in Modal popup extender. I am posting my question expecting help if anyone knows.

I display Modal Popup( which shows the grid rows and button controls in panel) on clicking imagebutton. I want to align the the button in panel to center ans currently its left aligned and looks awkward. Can anyone tell me how do we align the button control in Model Popup's panel..

Here is the existing code.

Code forbtnSubmit is underlined in Italic in below code for easy identification.

///<summary>

/// Event Handler for Grid selection

///</summary>

///<param name="sender"></param>

///<param name="e"></param>

protectedvoid apprvlsGrid_SelectedIndexChanged(object sender,EventArgs e)

{

if (apprvlsGrid.SelectedIndex >= 0)

{

vwbenftsImgBtn.Visible =true;

string gridAprveSwID;

// Validations on Approve and reject buttons using javascript

if(apprvlsGrid.SelectedIndex <= 7)

gridAprveSwID ="ctl00_ContentPlaceHolder1_apprvlsGrid_ctl0"

+ (apprvlsGrid.SelectedIndex + 2) +"_approveSwHdn";

else

gridAprveSwID ="ctl00_ContentPlaceHolder1_apprvlsGrid_ctl"

+ (apprvlsGrid.SelectedIndex + 2) +"_approveSwHdn";

apprvBtn.Attributes.Add("OnClick","return fnaprvValidate('" + gridAprveSwID +"')");

rejectBtn.Attributes.Add("OnClick","return fnrejValidate('" + gridAprveSwID +"')");

// Controls declared dynamically for Modal Popup using Ajax

Button vwbenftsBtn =newButton();

Button btnSubmit =newButton();

Panel container =newPanel();

container.Width = 400;

container.Height = 350;

container.BorderWidth = 1;

container.BackColor =Color.WhiteSmoke;

GridView benfGrd =newGridView();

//Assign IDs to variables that need to be refrenced later

container.ID ="Container1";

benfGrd.ID ="benfGrd";

benfGrd.AutoGenerateColumns =false;

benfGrd.Width = 400;

benfGrd.Height = 300;

Literal newline =newLiteral();

Literal spaces =newLiteral();

Approvals apprvls;

Approval aprvalVwBenfts =newApproval();

if (Session["aprvlsList"] !=null)

{

apprvls = (Approvals)Session["aprvlsList"];

int iApprvlsCount = apprvls.Count;

GridViewRow aprvlsSelectRw = apprvlsGrid.SelectedRow;

aprvalVwBenfts.BinId =Convert.ToInt64(aprvlsSelectRw.Cells[13].Text);

aprvalVwBenfts.CardId =Convert.ToInt64(aprvlsSelectRw.Cells[14].Text);aprvalVwBenfts.SetId =Convert.ToInt64(aprvlsSelectRw.Cells[15].Text);

aprvalVwBenfts.TableCd = aprvlsSelectRw.Cells[17].Text;

aprvalVwBenfts.EffDate =Convert.ToDateTime(aprvlsSelectRw.Cells[7].Text);

aprvalVwBenfts.SetDesc = aprvlsSelectRw.Cells[6].Text;

if (aprvalVwBenfts.TableCd =="B")

aprvalVwBenfts.TableID = aprvalVwBenfts.BinId;

else

aprvalVwBenfts.TableID = aprvalVwBenfts.CardId;

for (int iRow = 0; iRow < iApprvlsCount; iRow++)

{

if (aprvalVwBenfts.TableID == ((Approval)apprvls[iRow]).TableID

&& aprvalVwBenfts.SetId == ((Approval)apprvls[iRow]).SetId

&& aprvalVwBenfts.TableCd == ((Approval)apprvls[iRow]).TableCd&& aprvalVwBenfts.EffDate == ((Approval)apprvls[iRow]).EffDate)

{

int isetBenftCOunt;

isetBenftCOunt = ((Approval)apprvls[iRow]).getSetBenefitCount();

SetBenefit[] setSetBefts = (SetBenefit[])((Approval)apprvls[iRow]).getSetBenefits();

//Loads the Modal Pop up controls

// Dynamically create field columns to display the desired

// fields from the data source. Create a TemplateField object

// to display an author's first and last name.

TemplateField benfGridCol =newTemplateField();

// Create the dynamic templates and assign them to

// the appropriate template property.

benfGridCol.ItemTemplate =newGridViewTemplate(DataControlRowType.DataRow,"");

benfGridCol.HeaderTemplate =newGridViewTemplate(DataControlRowType.Header, aprvalVwBenfts.SetDesc);

// Add the field column to the Columns collection of the

// GridView control.

benfGrd.Columns.Add(benfGridCol);

benfGrd.DataSource = createGridData(setSetBefts, isetBenftCOunt);

benfGrd.DataBind();

vwbenftsImgBtn.ID ="vwbenftsImageBtn";

vwbenftsImgBtn.ToolTip ="View Benefits for Selected Set";

//vwbenftsImgBtn.Click += new ImageClickEventHandler(this.vwbenftsImgBtn_Click);

container.Controls.Add(benfGrd);

btnSubmit.CssClass ="btn";

btnSubmit.Text ="Close";

btnSubmit.ID ="btnSubmit1";

newline.ID ="newline";

newline.Text ="<br/> ";

//spaces.ID = "spaces";

//spaces.Text = "aaaaaaaaaaaaaaaaa";

//spaces.Visible = false;

//subBtnTble.Style = "center";

//subBtnTble.ID = "subBtnTble";

//subBtnTble.Controls.Add(btnSubmit);

container.Controls.Add(newline);

//container.Controls.Add(spaces);

container.Controls.Add(btnSubmit);

// Specify the Image button as Modal Popup target

modPop.TargetControlID = vwbenftsImgBtn.ID;

//Define the object to be shown inside of mod popup

modPop.PopupControlID = container.ID;

modPop.DropShadow =true;

modPop.X = 250;

modPop.Y = 100;

modPop.OkControlID = btnSubmit.ID;

// Add all the controls to Page's form

formApvl.Controls.Add(vwbenftsImgBtn);

formApvl.Controls.Add(modPop);

formApvl.Controls.Add(container);

}

}

}

}

}

Thanks

Shilpa


Actually, I don't think this has anything to do with this thread -- your question is more geared towards HTML / CSS. You can center any HTML entity using appropriate CSS. If you need more specific answers, I would recommend starting a new thread entirely in one of the other forums (while you are referring to an AJAX extender, your question really has nothing to do with AJAX.)

Returning Values with DynamicPopulateExtender

Hi guys,I need to update two different values on a page, which I'd like to calculate at the same time (Monthly Value and Annual Value). Is it possible to get DynamicPopulateExtender to return two values for different controls?It's not a simple case of *12 for Annual value, and it would really reduce processing time if I could calculate both at the same time.Andi

From what I understand, I don't think so. What about just using two UpdatePanels?

Reverse direction of veritcal slider?

Is it possible to reverse the direction of the slider extender? I'm using it vertically and would like the higher maximum value to be the top of the slider and the minimum value to be the bottom of the slider.

Hi,

what you can do is using negative numbers and then take the absolute value. For example, setting Minimum="-20" and Maximum="40" and then taking the absolute value of the slider. The problem is that if you use a bound control to display the slider's value, it will display the negative sign.

This scenario will be addressed in the next release, so thank you for reporting this.