Showing posts with label updatepanel. Show all posts
Showing posts with label updatepanel. Show all posts

Saturday, March 24, 2012

Modal Popup, Gridview and Updatepanel.

Here is I have.

A Page that has a button (button1), textbox (textbox1), and a modalpopup. The modalpopup extends a panel that has a usercontrol inside it.

Inside the Usercontrol I have some textbox's and a button (button2). And I also have an updatepanel with a gridview inside.
The update panel has a trigger referencing the button (button2). The gridview has a column with a button (selectbutton) inside. I also handle the rowcommand of the gridview to update textbox1 on the page.

When I click button1 the popup shows fine. Then I enter some stuff inside the textbox's for the usercontrol, and then click button2. The gridview updates as expected.

When I click on the button (selectbutton) inside the gridview I set textbox1 on the page to a value from the selectbutton's row and call the hide method of the modalpopup extender...but textbox1 does not update, and the modalpopup does not close.


Any ideas???



Please try your scenario with the recently available61106 release of the Toolkit (and ASP.NET AJAX Beta 2). If the problem persists, then please reply with acomplete, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!

Modal Popup, DetailsView and UpdatePanel combined.

Hi all, this is my first foray into Atlas (and ASP.net) and I have come stuck with the following problem:

I am developing a simple lookup screen that lists users names along with email addresses in a GridView. There is a DetailsView control that allows insertion of new users as required. The lookup is contained within an updatePanel so only this portion of the page is refreshed when items are added, deleted, or changed. This works fine until:

I put the DetailsView into an atlas ModalPopup and have an 'Add User...' button. At this point the whole page refreshes and I cannot for the life of me get it to work correctly.

I have tried everything I can think of, scoured the web and forums but still no luck. I can get two of the three items (UpdatePanel, DetailsView, ModalPopup) working at once but the addtion of the third causes it all to go horribly wrong.Confused [*-)]

Can anyone out there help me?

Try adding UseSubmitBehavior="false" to the button that's causing the refresh. If that doesn't help, please post a simple sample demonstrating the problem. Thanks!

ModalDialog inside updatepanel

I've got a button that shows a modal dialog box. The idea is to add an object to a database, then refresh a listbox on the main page. The dialog works correctly, except with click cmdOk, the server side function is never called. I suspect it's because there's no longer an event handler registered by JS that calls the script to do the postback. I probably need to create a client side script using OnOkScript="onOK()", but I have no idea how to make the page postback to call cmdNewObject_Click without a full postback. Any ideas?

Thanks,

Rick

<asp:LinkButtonID="cmdAddObject"runat="server"Text="Add Object"></asp:LinkButton>

<cc1:ModalPopupExtenderID="ModalPopupExtender1"runat="server">

<cc1:ModalPopupPropertiesBackgroundCssClass="modalBackground"OkControlID="cmdOk"CancelControlID="cmdCancel"DropShadow="true"PopupControlID="pnlAddObject"TargetControlID="cmdAddObject"></cc1:ModalPopupProperties>

</cc1:ModalPopupExtender>

<atlas:UpdatePanelID="pnlPopup"runat="server"Mode="conditional">

<Triggers>

<atlas:ControlEventTriggerControlID="cmdOk"EventName="Click"/>

</Triggers>

<ContentTemplate>

<asp:PanelID="pnlAddObject"runat="server"CssClass="modalPopup"Style="display: none">

<div>

<divid="ObjectName">

<asp:TextBoxID="txtObjectName"runat="server"></asp:TextBox></div>

<div>

<divid="OkButton">

<asp:ButtonID="cmdOk"runat="server"OnClick="cmdNewObject_Click"Text="New Object"/></div>

<divid="CancelButton">

<asp:ButtonID="cmdCancel"runat="server"Text="Cancel"/></div>

</div>

</div>

</asp:Panel>

</ContentTemplate>

</atlas:UpdatePanel>

Seethis post and maybe consider removing the OkControlID property so the Ok button can postback normally (thereby dismissing the ModalPopup). I'm thinking you may also want to get rid of the UpdatePanel here as I'm not sure it'll ultimately be necessary.

Wednesday, March 21, 2012

ModalPopup & UpdatePanel

OK, so my first question is, should it be possible to call an update panel from the modal popup?

I think I have a pretty common task I'm going after here. On the page I have a repeater that displays all the information in the table. Then under that table, I have a spot where you can add new entries to the table. The update panel works perfectly from there but when I attempt to call the same update panel from the OK button in my modal it doesn't do anything.

So here is the code that is important:

1[WebMethod()]2public void saveModal(string strItemID,string strItemDesc,string strItemAmount,string strItemLocked,string strItemOrder)3 {4 SqlDataAdapter daItemsEdit =new SqlDataAdapter("SELECT * FROM tblIssueItems WHERE itemID = '" + strItemID +"' AND generation = '" + strCurrentGen +"'", myConn);5 daItemsEdit.Fill(dsEdit,"tblIssueItems");6 DataTable tblIssueItemsEdit = dsEdit.Tables["tblIssueItems"];78 DataRow rowEdit = tblIssueItemsEdit.Rows[0];910 rowEdit["sortOrder"] = strItemOrder;11 rowEdit["itemDescription"] = strItemDesc;12 rowEdit["amount"] = strItemAmount;13 rowEdit["lock"] = strItemLocked;1415 SqlCommandBuilder sqlBuilder =new SqlCommandBuilder(daItemsEdit);//Used for SQL Connections16 daItemsEdit.UpdateCommand = sqlBuilder.GetUpdateCommand();17 daItemsEdit.Update(dsEdit,"tblIssueItems");1819//Update Table20 dbUnlocked();21 }2223public void dbUnlocked()24 {25//Grab All Unlocked Items26 SqlDataAdapter daItems =new SqlDataAdapter("SELECT * FROM tblIssueItems WHERE issueID = '" + strCurrentIssue +"' AND generation = '" + strCurrentGen +"' AND lock <> '1' ORDER BY sortOrder, itemID", myConn);27 daItems.Fill(dsRep,"tblIssueItems");2829if (dsRep.Tables["tblIssueItems"].Rows.Count != 0)30 {31 pnlUnlocked.Visible =true;32 repUnlocked.DataSource = dsRep.Tables["tblIssueItems"].DefaultView;33 repUnlocked.DataBind();34 }35else36 {37 lblNoUnlocked.Visible =true;38 }3940 dsRep.Clear();41 }4243public void btnSubmit_Click(object sender, EventArgs e)44 {45if (Page.IsValid)46 {47//Determine Next ItemID Number48int intItemID = Convert.ToInt32(strLastIDUsed);49 intItemID++;5051//Add New Record52 SqlDataAdapter daAdd =new SqlDataAdapter("SELECT TOP 1 * FROM tblIssueItems", myConn);53 daAdd.Fill(dsAdd,"tblIssueItems");5455//Create a data row56 DataRow newRow = dsAdd.Tables["tblIssueItems"].NewRow();5758 newRow["issueID"] = strCurrentIssue;59 newRow["generation"] = strCurrentGen;60 newRow["itemID"] = intItemID;61 newRow["sortOrder"] = ddlSortOrder.SelectedItem.Value;62 newRow["ItemDescription"] = txtDesc.Text;63 newRow["Amount"] = txtAmount.Text;6465//Add the datarow to the dataset66 dsAdd.Tables["tblIssueItems"].Rows.Add(newRow);6768//Use Command Building to create an insert command69 SqlCommandBuilder sCB =new SqlCommandBuilder(daAdd);7071//Update the DB with values72 daAdd.Update(dsAdd,"tblIssueItems");7374//------------------------75 //Update Last Item ID Used Column76 SqlCommandBuilder sCBU =new SqlCommandBuilder(daIssue);77 daIssue.UpdateCommand = sCBU.GetUpdateCommand();7879 tblIssue.Rows[0]["lastItemID"] = intItemID;8081 daIssue.Update(dsAll,"tblIssue");8283//Update Table84 dbUnlocked();85 clearAddArea();86 }87 }
So in the code above, everything in the WebMethod.SaveModal works exactly as designed. I included my other button on the page that works as designed so you could see that as well. On the other side of the code, here is what I did for the updatePanel.
  
1 <atlas:UpdatePanel runat="server" id="up1">2 <triggers>3 <atlas:controleventtrigger controlid="btnSubmit" eventname="Click" />4 <atlas:controleventtrigger controlid="OkButton" eventname="Click" />5 </triggers>6 <ContentTemplate>7<asp:Panel runat="server" ID="pnlUnlocked" Height="200" ScrollBars="auto" Visible="false">8 <asp:repeater ID="repUnlocked" runat="server">9 <itemtemplate>10 ...11 <a href="javascript: myModalPop('<%# DataBinder.Eval(Container.DataItem, "itemID") %>'); $object('MP1')._show();">Edit</a>12 ...13 </itemtemplate>1415 <FooterTemplate>16 </table>17 </FooterTemplate>18 </asp:repeater>19 </asp:Panel>20 </ContentTemplate>21 </atlas:UpdatePanel>
Thanks to anyone who can help me out.
Richard 

Hi Richard,

Could you also include the markup for your modal popup? It would help in trying to diagnose this.

Thanks,
Ted

<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" style="display:none"> <atlas:updatepanel id="up" runat="server" mode="Always" rendermode="Inline"> <contenttemplate> <br /> <h4>Edit Record</h4> <table width="350" width="100%" border="0"> <tr> <td>Sort Order</td> <td><asp:DropDownList runat="server" Width="100%" ID="ddlSortOrderE" CssClass="FormInput"><asp:ListItem Text="1" Value="1" /><asp:ListItem Text="2" Value="2" /><asp:ListItem Text="3" Value="3" /><asp:ListItem Text="4" Value="4" /><asp:ListItem Text="5" Value="5" /><asp:ListItem Text="6" Value="6" /><asp:ListItem Text="7" Value="7" /><asp:ListItem Text="8" Value="8" /><asp:ListItem Text="9" Value="9" /><asp:ListItem Text="10" Value="10" /></asp:DropDownList></td> </tr> <tr> <td>Item Description</td> <td><input type="text" id="txtDescE" class="FormInput" value="" /></td> </tr> <tr> <td>Amount</td> <td><input type="text" id="txtAmountE" class="FormInput" value="" /></td> </tr> <tr> <td>Lock?</td> <td><input type="checkbox" id="chkLockedE" class="formInput" /></td> </tr> </table> <center> <asp:Button runat="server" ID="OkButton" Text="OK"></asp:Button> <asp:Button runat="server" ID="CancelButton" Text="Cancel"></asp:Button> </center> <input type="hidden" id="hidRegID" value="" /> </contenttemplate> </atlas:updatepanel> </asp:Panel>

Here is the code. Thanks for any help you can provide. Thanks.

Richard


Oh, here is another strange one for everyone that I ran into today.

So I have the updatepanel that works with no issues. If I then try to click the edit button to a newly added record the modal popup appears but the OK button never closes it. That will be issue number #2 for me to figure out.

Also, if you need/want to see the page/error in action, please just let me know and I can post a link to where the page can be found.

Thanks for all of your hard work (and that is for everyone). The Atlas project and controls are some of the most exciting stuff I have seen in web development for a while.

Richard


has anyone figured out a solution for this one yet?

I was never able to get a fix/resolve to this one. The good news for me was, the project that I was using this in was canceled so I got to put it on the back burner.

Richard


I don know that the ok and cancel buttons cannot be within the updatepanel to work.

ModalPopup + UpdatePanel + UpdateProgress

I have an operation that takes about 1min to complete. I like the updatepanel and updateprogress controls but I would like to incorporate these with a modalpop. I would like the popup to contain the updateprogress control. I tried to implement this but it does not work. Has anyone tried to do something like this?I still have the same Problem. I want to user a ModalPopup in combination with UpdateProgressTemplate. Is there any possibility to goin' like that?

@. MVPs and all Gurus: HELP PLS ;p

greets from Germany @. 38°C ;p
I have the same question, you can check it herehttp://forums.asp.net/thread/1406095.aspx