Showing posts with label gridview. Show all posts
Showing posts with label gridview. Show all posts

Wednesday, March 28, 2012

UpdateProgress panel in a Gridview Row

Hi,

I have a linkbutton on gridview row that performs a function related to the row when it is clicked. I am trying to add an updateprogress Panel to each row to allow the user to know somethign is happening when button is clicked. I can not get this to work. in the row template I have the updateprogress panel and tied the event to the buton click on the row and basically all update panels in the rows show up and nothing happens when I click on a button. Does anybody have any ideas how to go about updateprogress in GridView Row?

Thanks,

Mo

Hi ,

From what I understand.

Why do you want dedicated UpdateProgress Panels for each row ? Cant just one Progress panel suffice?

If its a question of letting the user know which row is being updated, go with CSS / setLocation() to set the location of the Updateprogress Panel on the Page upon clicking the button

Thanks,

Phanatic


Hi,

The reason is wht you suggested. I have a progresspanel on top of the page but when a row is updated it may not be visible. I am not familia with CSS/SetLocation. Could you tell me more?

Thanks,

Mo

UpdateProgress stops working

Hello everybody,

my problem: I have a gridview in an update panel, and the gridviews header contains some DropDownLists for filtering data. Also the Gridview is enabled for Sorting

and Paging. All works fine. But to inform the user that the action he started is on the way, i included a UpdateProgress with a gif animation. So when the user starts filtering

or sorting the gif animation is shown and animated. But after a short time, it stands still. A second or two later, the GridView is bound completely and the gif disappears.

So something seems to block the UpdateProgress. What am i doing wrong ? the gif animation is on top of the gridview.

any hint is aprreciated, thanks a lot !

This happens when the browser is rendering the response... Haven't found really anything to do about it :(

-Damien

UpdateProgress slow to show even if DisplayAfter=0

Hi, I have an UpdatePanel with a bunch of buttons, checkboxes and combobox and a GridView. I also have an UpdateProgress set with DisplayAfter="0". Sometimes, when it's taking a while to process the data, the UpdateProgress doesn't show up for 2-3 seconds and then gets displayed.

Is there any reason why it wouldn't always show up instantly? Is the trigger to show the UpdateProgress sent from server or client?

I use this CSS style for the updateProgress, could this be the problem (using IE7)?

#UpdateProgress1 {top:50%;width:100%;position:fixed;text-align: center;background:#dd2;}
Thanks,
Christian

Is there any image in Update Progress..


No images. Here is what I use :

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
DisplayAfter="0">
<ProgressTemplate>
<div style="height: 50px">
<br />
Loading data ...
<br />
</div>
</ProgressTemplate>
</asp:UpdateProgress>


Try to give a 100 value may be 0 is some default


Thanks for the suggestion, but itt didn't help. It just took a little longer to show :)


what browser r u using?


I tried both IE6 and IE7


Do you have mupliple UpdatePanels?

Do you have the latest ASP.Net AJAX 1.0?


I have a single UpdatePanel that takes most of the page and I have ASP.NET AJAX 1.0 that I downloaded about 2 weeks ago.

Monday, March 26, 2012

updating datagrid view

Hi,

I am new to ajax,Can anyone help me with updating the gridview on clicking hyperlingk in one of its templatecolumn.

Itechs

Hi Itechs,

Just place the gridview in an updatepanel, and disable the callbackoptions of the gridview.

Then you should have a gridview with ajax fuctionallity (=no full page refreshes).

If you have questions/remarks please do so!

Kind regards,
Wim

Updating from a template control

Hello,

I'm having an issue getting a Label inside of an UpdatePanel to change when a button in a GridView PagerTemplate is clicked. I have a label that I am showing the Page X of Y count. I have defined the First, Next, Previous and Last commands as Buttons in the PagerTemplate. The problem is that when I click the button, in the code behind I am setting the Text of the label, but it is not changing on the page. I cannot register the button in the UpdatePanel Triggers, because it is in the PagerTemplate. How can I make the label update from the button?

Thanks,

Nick

If I set up a Trigger on the gridview's databound event, will this cause the label to update?

Thanks,

Nick


You don't need to go that way.

Just do ScriptManager.GetCurrent( this.Page ).RegisterAsyncPostBackControl( control );

You have to do this on each post though. (ItemCreated will get fired each post)


Would this be done in the Pages Load event, or the button's click event?

Thanks,

Nick


Subscribe to the ItemCreated event in your grid and do it on all the rows. (e.Item).

Updating GridView control in a ModalPopupExtender

I feel that this should be a simple enough pattern, but I'm having trouble figuring out what's best to do, and how to implement it...

Offically sactioned best practices needed!

I've got a page with a gridview on it, where a link button in each row can pop up a panel using the ModalPopupExtender in order to allow the user to edit details from another table. The panel that pops up has a gridview on it that allows for in-line editing of rows in this secondary table. I show Edit and Delete buttons for each row, and when in Edit mode, I show the user Update and Cancel buttons. The panel itself has only a Close button referenced as the OKControlID of the ModalPopupExtender. The first gridview is enclosed in an UpdatePanel to avoid unnecessary page reloads since nothing the user does on the popup will affect the results of the top gridview.

My question is this: What is the best way to ensure that the user has clicked either Update or Cancel in the gridview before closing the popup? I would like to do this so that I ensure that the gridview on the popup is returned to ReadOnly view for the next possible edit and not left in Edit mode.

First Attempted Solution:

No validation needs to take place, so ideally I would simply like to automatically update whatever the user may or may not have done in order to return the gridview to edit mode. I tried to remove btnClose as the OKControlID of the popup extender and put server side code in the OnClick event of the button instead to detect if the gridview was in edit mode (EditIndex<>-1) and then call the UpdateRow method for the current row. This worked, but the page reload caused by this button is undesirable. If there was some way to fire off the UpdateRow method from the client side (i.e. from the OnOKScript of the popup extender), this would be ideal.

Second Attempted Solution:

I also tried to simply disable the Close button on the panel via client side script when I click the Edit button in the gridview and then re-enable it when the user clicks Update or Cancel, thus preventing the closing of the popup until the user has performed one of those tasks, but I can't figure out the javascript needed for those buttons' OnClientClick properties.

Any help with either method (or suggestions on an alternate one!) would be greatly appreciated...

- Ronn

I found my own workaround to this by simply not utilizing an OKControlID button on the panel at all. I put code in the ItemUpdated and ItemDeleted events of the GridView itself to call back to a public method of the form which calls the ModalPopupExtender.Hide() method.


I use this technique when making a progress bar visible/invisible:

var imgBar = document.images.namedItem("imgProgBar");
imgBar.style.visibility = "visible";

Perhaps you could use this idea within your OnLoad() and OnUnLoad() functions.

Either that or I believe you could use the "enabled" attribute as well. You should verify that, though.

Good luck,

Bob

Updating GridView ,

Hi All,

I am having a problem in updating my GridView partially (AJAX). Here is my scenario.
I have 2 UpdatePanel. (DisplayUpdatePanel and EditUpdatePanel)

Inside "DisplayUpdatePanel" i have 1 GridView which shows my data from my database. i'm using XML schema DataSet and ObjectDataSource to bound data to my gridview
SelectMethod runs perfectly.

Inside "EditUpdatePanel" i have some textboxes, and links buttons (Update,Delete,New) and one HTML Editor.

The way it works as follow:

1. If one row is selected in "DisplayUpdatePanel" then My "EditUpdatePanel" will get updated with the same values from "DisplayUpdatePanel" automatically.

2. Inside my "EditUpdatePanel", i can edit all the values.

3. Once i finished, i can click "Update" link button to execute my Update Stored procedure. which i Typed it manually instead of being autogenerated by the wizard.

Update Stored Procedure runs perfectly as i expected.

My problem here is that my "DisplayUpdatePanel" doesnt update automatically once the data has been updated.

anyone know how to solve my problem?


below are my triggers from both UpdatePanel.

"DisplayUpdatePanel"

<Triggers>
<asp:AsyncPostBackTrigger ControlID="LNK_UPDATE" EventName="DataBinding" />
</Triggers>

"EditUpdatePanel"

<Triggers>
<asp:AsyncPostBackTrigger ControlID="DisplayUpdatePanel" EventName="SelectedIndexChanged" />
</Triggers>

Thank You Very Much

On3

<Triggers>
<asp:AsyncPostBackTrigger ControlID="LNK_UPDATE" EventName="Click" />
</Triggers>


Thank yourmaiya for your reply.

I've tried your solution, but still not my gridview is still the same. it doesn't update by itself ...
is there any relation with my multiview?

because i put all my update panels inside one of the views.
thanks



Once you update GridView in server with your StoredProcedure then call DisplayUpdatePanel.Update();


Assuming that you have done what was previously suggested, that is, ensure the UpdatePanel's children are rendered via invoking the Update() method. I also found that disabling view state on the GridView solves some issues with the GV updating after an asyn postback. Hope this helps.


Hi Amit, thank you for your reply :)

my DisplayUpdatePanel still doesnt update its content by itself...
What do you mean by "Update GridView in Server" ... because, as far as i understand,
my scenario is actually updating the database directly through my StoredProcedure.

below is my snippet for updating my data.

protected void UpdateArticle()
{
MyConn = new Connection();
DateTime CurrDate = DateTime.Now; // Get the Current Date and Time.
SqlCommand SqlCmd = new SqlCommand("Article_Update", MyConn.GetConnection());
SqlCmd.CommandType = CommandType.StoredProcedure;

Label ArticleID = (Label) GridView3.SelectedRow.FindControl("Label2");

SqlCmd.Parameters.AddWithValue("@.Title", TXT_ArticleTitle.Text);
SqlCmd.Parameters.AddWithValue("@.Cat_Id", Convert.ToInt32(DRP_FileUnder.SelectedItem.Text));
SqlCmd.Parameters.AddWithValue("@.Content", FCKeditor.Value);
SqlCmd.Parameters.AddWithValue("@.Summary", TXT_Summary.Text);
SqlCmd.Parameters.AddWithValue("@.Original_ArticleID", Convert.ToInt32(ArticleID.Text));

if (MyConn.isConnected() == false)
MyConn.Connect();

SqlCmd.ExecuteNonQuery();
MyConn.CloseConnection();

}

is there any more clues for my case ?

thank you Amit



on3_cool:

protected void UpdateArticle()
{
MyConn = new Connection();
DateTime CurrDate = DateTime.Now; // Get the Current Date and Time.
SqlCommand SqlCmd = new SqlCommand("Article_Update", MyConn.GetConnection());
SqlCmd.CommandType = CommandType.StoredProcedure;

Label ArticleID = (Label) GridView3.SelectedRow.FindControl("Label2");

SqlCmd.Parameters.AddWithValue("@.Title", TXT_ArticleTitle.Text);
SqlCmd.Parameters.AddWithValue("@.Cat_Id", Convert.ToInt32(DRP_FileUnder.SelectedItem.Text));
SqlCmd.Parameters.AddWithValue("@.Content", FCKeditor.Value);
SqlCmd.Parameters.AddWithValue("@.Summary", TXT_Summary.Text);
SqlCmd.Parameters.AddWithValue("@.Original_ArticleID", Convert.ToInt32(ArticleID.Text));

if (MyConn.isConnected() == false)
MyConn.Connect();

SqlCmd.ExecuteNonQuery();
MyConn.CloseConnection();

DisplayUpdatePanel.Update();

}


Hi AMit,

i still cannot use the "DisplayUpdatePanel.Update()" for my case.
however, i found the solution by my self.
here is what i have done.
1. Instead of executing my UpdateStored Procedure directly as the link button click, i attached my stored procedure into my ObjectDataSet.
2. Then i set the default value of each my "UpdateParameters" in ObjecDataSource onto the appropriate controlId.Text
3. In My protected void LNK_UPDATE_Click(object sender, EventArgs e) , i just call my function which executes the ObjectDataSource update command.

The snippet as follows.

protected void LNK_UPDATE_Click(object sender, EventArgs e)
{
UpdateArticle(); // Execute UpdateCommand.
ClearALLValues(); // Clear All values in the forms.
SetButtonsIn_EditPanel(false, false); // Set Appropriate buttons.
}

protected void UpdateArticle()
{
try
{
Admin_ArticlesODS.Update();
}
catch (System.Reflection.TargetInvocationException error)
{
FCKeditor.Value = error.ToString(); // Display error catch by the TargetIncovationExection to the editor
}

}

Hopefully It helps.

Updating gridview without postback

Hi!

I want to refresh a gridview without doing postback every second and for do it I use a System.Timer.

I have the grid into an updatepanel and I want to know how can I make, from the elapsed event of the timer, to refresh the grid.

I am trying to use theICallbackEventHandlerbut I can't reach my target.

Could anyone said me if I can do it and how could I do?

I have search code samples but they aren't useful for me.

Try this:

Put a button on the form somewhere, set the onclick event to trigger an update of the gridview. Check that pressing this button updates the gridview as expected.

Make this button invisible by using style='Display:none;'.

On the timer elapsed event add a call to myButton.Click();

Andy.


Finally I have used the Anthem.net library and its panel component. It was very easy working with it doing the refresh without the postback.

There is more information inhttp://www.codeproject.com/Ajax/AnthemNET.asp.

Updating Gridviews

I need to update a gridview with another gridview, but I can't figure out how to do it.

I've got the AJAX component installed and it looks easy, but I can't find the right combination to make it happen.

I want the 1st control to look like this on the page...

item1

item2

item3

then when I choose one of them, I want it to update the gridview beside it.

Right now, I'm playing with the selected properties, but don't seem to have much luck.

Can anybody help me with this? it works just fine with other controls, but not with the gridview. And I know there's just something simple I'm missing.

thx.

Hello,

I would suggest using nested update panel controls. Put the second grid in one update panel, and then put both grids in new update panel. Then just put the event on wich you want the second gridView to update to the triggers collection. Example athttp://www.asp.net/AJAX/Documentation/Live/overview/UpdatePanelOverview.aspx section "Using nested UpdatePanel controls".

Updating UpdatePanel contents from Popup

Welcome, can you help me solving that problem

I have a UserControl UserControl1 that contains Gridview gridview1 and input Button button1, An UpdatePanel contains UserControl1 in a page, when i press that button1 it opens a popup window which contains a input button popUpButton and a TextField, the pop up is used to add a new record to the datasource of gridview1, Then i rebind the updated datasource to gridview1, Hover the problem is the gridview1 don't render the new row added although it's datasource is updated ..!
Notes:

- I tried to use both modes of UpdatePanel (Always and Condtional) but no hope
- The UpdatePanel is in the page NOT in Usercontrol1
- There is one ScriptManager and two other update panels in same page
- I use .NET Callback interface methods When I press popUpButton IN THE popup control so that i can trigger serverside update datasource process from client side javascrip code

so how i can render that changes from datasource to gridview??

Hi

This link helps youRefresh GridView in Parent Page.

Regards.

Wednesday, March 21, 2012

Urgent Please Help

Thanks for taking time in reading this thread.

I have Gridview contorl inside Update panel

Gridview in dynamic and I have added EditTemplateField to this grid.

When I click on Edit button , page flickers and it does not go into edit event.

I am not using sqldatasource or objectdatasource, I have custom classes.

What do you think is the problem ?

Again Thanks.

For reference here is the code

**************************************Code to create Edit button**************************************

TemplateField templateFieldEdit =newTemplateField();

templateFieldEdit.ItemTemplate =newReportViewHelper(ListItemType.Item, ReaderColumn[ReportViewHelper.ColumnDBName].ToString().Trim(),"Command");

**************************************Design Edit Button**************************************

elseif (_columnControlType =="Command")

{

ImageButton edit_button =newImageButton();

edit_button.ID ="edit_button";

edit_button.ImageUrl ="~/Images/edit.gif";

edit_button.CommandName ="Edit";

edit_button.Click +=newImageClickEventHandler(edit_button_Click);edit_button.ToolTip ="Edit";

container.Controls.Add(edit_button);

}

************************************** this is the method that is not triggering *************************************

void edit_button_Click(object sender,ImageClickEventArgs e)

{

}

Take a look at this articlehttp://aspalliance.com/1125_Dynamically_Templated_GridView_with_Edit_Delete_and_Insert_Options. It's real helpful for creating dynamic templates...

-Damien

urgent: Modal popup Extender is not closing after validation fires

I have an edit modalpopupextender inside the gridview that appear when linkbutton is clicked all of this inside an update panel and its working great.

when the modalpopupextender popsup i have two buttons "Close" and "Save" button and when the user click on "Close" it closes the modalpopupextender - again its working great.

but the problem isthat, when i click on "Save" button it FIRES validation and in the modalpoupextender i have twocustomvalidation controlsthat validates whether the user have check at least one checkbox or not so when the user hit on "Save" button the validation fires whic is great so far butwhen i clik on "Close" button its not closing my modalpopuextender ?

here is my close button looks like:

<ajaxToolkit:ModalPopupExtender ID="mpePerson" runat="server" TargetControlID="btnHiddenPerson"
PopupControlID="pnlPerson" OkControlID="bModalDialogCancel"CancelControlID="bModalDialogCancel" BackgroundCssClass="modalBackground"
PopupDragHandleControlID="PersonCaption">
</ajaxToolkit:ModalPopupExtender>

<asp:ButtonCausesValidation="false"ID="bModalDialogCancel" runat="server"Text=" Close "ToolTip="Close this window"/>

what is going on here?

You have your OkControlID and your CancelControlID both pointing to the same button ('bModalDialogCancel').

------------------
When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.


i fixed myself, i was passing the wrong id.

thanks.

Use Ajax in Control

Hello,

I am creating a class library where I have a custom web control.

This control has Labels and a GridView.

I want to use an UpdatePanel but there is a problem:

VS 2005 is not recognizing the Update Panel that I created. How should I do this?

Should I just create my web control and then place it inside an Update Panel on my page?

Thanks,

Miguel

How are you adding the UpdatePanel? Is this a user control? What do you mean when you say that VS 2005 is not "recognizing" the UpdatePanel that you created; what errors are you getting, ie, what happens?