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

Wednesday, March 28, 2012

Atlas with not XML-HTTP ready browser ?

Hello,

I've juste tried Atlas, I put a GridView in a <atlas:UpdatePanel> and it works perfectly, I just wonder : what if the client's browser is not XML-HTTP ready ??

It throw an error, or it just work with a postback (without using Ajax) ?

Nobody has an answer...?

Atlas with multiple GridViews

I have a page which needs to allow user to populate fields by selecting rows from Gridviews. I would like to temporarily display a GridView with search field to locate a row, then populate the associated field with a value from GridView row and move on to the next field with it's own associated GridView.

Is it possible to do true Ajax with Atlas, e.g. load content dynamically? It would be nice if the GridViews didn't load their corresponding data sources until acutally needed for a given field. I thought I might use the Atlas Control Toolkit's collapsible panel component but not sure if this is the best way to only render a GridView when it's needed.

Any suggestions on how to go about this would be appreciated.

hello.

though i haven't understood your scenario very well, i think that atlas can help you accomplish this. since you've spoken about gridviews, i think you'll want to use the server side approach, where you use an updatepanel to have a partial update zone on the page.

in these situations, you can have a placeholder and add controls dinamically to that control during postbacks (partial or complete).


Hi Luis

I'm not sure I understand my scenario completely either ;)

But suppose I have a drive name field. If a user clicks on choose button, a panel with search field and GridView pops up, allowing the user to select a driver from the user database. The driver name field is populated and the GridView disappears. Since I have a number of fields I need to allow the user to fill by choosing from a GridView I don't want to populate the page with GridViews at the outset.

Your idea sounds like it could work, but I'm unclear on what events I should use to dynamically add the GridView and search field. It would be great if you could direct me to a sample where someone uses Atals to replace content dynamically (would be great if it was with a GridView ;).

Thanks much!

hello.

hum...i think that basically we're talking about dynamic replacement of a portion of the page. you may use usercontrols to encapsulate both parts (on has the textbox and the search button and the other user control has the grid) and you'll need to work with the params collection in order to replace the controls dynamically (search the forums because one or two days ago i've wrote a small sample that shows how to replace the usercontrols dynamically in an updatepanel).

Monday, March 26, 2012

Atlas UpdatePanel wont display certain data records

I have a page with a GridView that displays about 50 records, 5 per page. Works great without Atlas. Once I added an Atlas UpdatePanel to the page, the paging of the GridView stopped working. I've researched the problem, added a DetailsView control to the UpdatePanel, and discovered that the 9th record of the dataset won't display with Atlas, but will without Atlas. I can't find anything unusual with the data record. Any help/suggestions? Thanks.

Is it possible that the record contains some data that is not properly HTML encoded? If it's not confidential data, can you show part of that record so we can see it?

We made a number of fixes in the March CTP to allow for more relaxed support for HTML. In the next CTP we will have even better support for data that isn't quite XHTML compliant as well.

Thanks,

Eilon

Atlas UpdatePanel

I have several textboxes, a gridview and an image in a panel that need to be updated based upon info entered into a textbox. Everything works like a champ when I don't use the Atlas UpdatePanel, but I can't seem to figure out how to get even one section to work. Initially I had all 3 areas wrapped into the UpdatePanel and now I'm just trying to update some textboxes with info returned from the server. Neither one works. I tried the PostBackTrigger and AsynchPostBackTrigger. Can anyone tell me what I'm doing wrong?

<asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional" >
<ContentTemplate>

<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="width:125px" align="right" class="smalltext"><asp:Label ID="lblAccount" AssociatedControlID="txtAccount" runat="server">Account #: </asp:Label></td>
<td class="smalltext" style="width:175px">
<asp:TextBox ID="txtAccount" OnTextChanged="txtAccount_TextChanged" MaxLength="16" runat="server" CssClass="textbox"></asp:TextBox>
<img src="http://pics.10026.com/?src=Images/merge.gif" style="vertical-align:text-bottom" alt="Grab customer info from CSG" onclick="getCustomerInfo()" />

</td>
<td rowspan="2" style="width:70px">
<asp:Panel runat="server" ID="pnlPrevEntries">
<a href="http://links.10026.com/?link=javascript: void(0)" onclick="overlay('caution', 'PrevEntries', 'right')"><img src='Images/caution.png' id='caution' /></a>
</asp:Panel>
</td>
<td style="text-align:center" valign="top" class="smalltext">
<span id="Fullname"><%=Session("Fullname")%></span><span id="extension" style="display:none"><%=Session("extension") %></span><br /><%=Session("Role")%>
</td>
</tr>
<tr>
<td align="right" class="smalltext"><asp:Label ID="lblName" AssociatedControlID="txtName" runat="server">Name (Last, First): </asp:Label></td>
<td>
<asp:TextBox ID="txtName" MaxLength="100" runat="server" CssClass="textbox"></asp:TextBox><!--<input type="text" ID="txtName" MaxLength="100" Class="textbox">-->
<div id="customerInfo">
<asp:TextBox id="txtAddr1" runat="server"></asp:TextBox>
<asp:TextBox id="txtAddr2" runat="server"></asp:TextBox>
<asp:TextBox id="txtCity" runat="server"></asp:TextBox>
<asp:TextBox id="txtState" runat="server"></asp:TextBox>
<asp:TextBox id="txtZip" runat="server"></asp:TextBox>
<asp:TextBox id="txtPhone" runat="server"></asp:TextBox>
<asp:TextBox id="txtRetentionId" runat="server"></asp:TextBox>
<asp:TextBox ID="txtLobChanged" runat="server"></asp:TextBox>
<asp:TextBox ID="txtComments" runat="server"></asp:TextBox>
<asp:TextBox ID="txtPkgID" runat="server"></asp:TextBox>
<asp:TextBox ID="txtReasons" runat="server"></asp:TextBox>
<asp:TextBox ID="txtUncontrollable" runat="server"></asp:TextBox>
<asp:TextBox ID="txtTechProbs" runat="server"></asp:TextBox>
<asp:TextBox ID="txtComps" runat="server"></asp:TextBox>
</div>
</td>
</tr>
</table>
<!-- GridView for previous entries -->
<div id="PrevEntries">
<asp:GridView ID="grdPrevEntries" runat="server"
DataKeyNames="retentionId"
AutoGenerateColumns="False"
CssClass="smGridview"
GridLines="both"
CellPadding="3">
<Columns>
<asp:TemplateField >
<ItemTemplate>
<a href="http://links.10026.com/?link=http://forums.asp.net/AddPost.aspx?ForumID=1007#" id="<%# Eval("retentionId") %>" onclick="selectPrevEntry('<%# Eval("retentionId") %>')">SELECT</a>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="tDate" HeaderText="DATE" DataFormatString="{0:MM/dd/yy}" HtmlEncode="False" />
<asp:BoundField DataField="lob" HeaderText="LOB" />
<asp:BoundField DataField="subreq" HeaderText="SUBREQ" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="reason" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="inPkg" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="outPkg" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="offer" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="comments" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
</Columns>

</asp:GridView>
<p style="text-align:right; margin:20px 3px 3px 0"><a href="http://links.10026.com/?link="#" onclick="overlayclose('PrevEntries');return false"> CLOSE</a></p>
</div> </ContentTemplate>
<Triggers><asp:AsyncPostBackTrigger
<asp:PostBackTrigger ControlID="txtAccount" />

</Triggers>

</asp:UpdatePanel>
<asp:UpdateProgress runat="server" ID="prgPrevEntries">
<ProgressTemplate>
<img src="http://pics.10026.com/?src=Images/xsmloading.gif" alt="Loading" />
</ProgressTemplate>
</asp:UpdateProgress>


One simple thing I can see is that you don't need the triggers since the textbox that's firing the event is actually in the UpdatePanel (you don't need the triggers section at all... triggers are used mainly to handle situations where you want an external control's postback to cause Ajax Postbacks.

Use of javascript is sometimes something to worry about (but usually things fail with javascript that is simply written to the form to execute inline (and not attached to an event)... I don't see anything like that, so my guess is the triggers section.


BTW, you do have a ScriptManager on the form, right? That's the most common error... ScriptManager with EnablePartialRendering="true" it should look like this

<asp:ScriptManager id="sm1" runat="server" EnablePartialRendering="true" />

Jay Kimble
-- The Dev Theologian
-- http://codebetter.com/blogs/jay.kimble/

Atlas update control doesnt refresh the gridView content

I have atlas update panel with mode=conditional which means that it should refresh the gridView only when trigger is fired.

I create a trigger which fires when selectedValue is changed on dropdownlist.

But gridView is refreshed only first time, when dropDownList is changed. All other changes in dropDown - gridView remains the same. AnyBody know why?

If I change Mode to always than gridView is refreshed on every dropDown change.

Here is the example:

<

asp:DropDownListID="DropDownList2"runat="server"AutoPostBack="True"><asp:ListItemValue="False">Active</asp:ListItem><asp:ListItemValue="True">Completed</asp:ListItem></asp:DropDownList>

<

atlas:UpdatePanelID="p1"runat="server"Mode="Conditional"><ContentTemplate><asp:GridViewID="GridView1"CssClass="gridView"AlternatingRowStyle-CssClass="even"GridLines="None"runat="server"AllowPaging="True"AllowSorting="True"AutoGenerateColumns="False"DataKeyNames="taskID"DataSourceID="ObjectDataSource1"><Columns><asp:CommandFieldShowEditButton="True"/><asp:BoundFieldDataField="name"HeaderText="name"SortExpression="name"/><asp:CheckBoxFieldDataField="complete"HeaderText="complete"SortExpression="complete"/></Columns><AlternatingRowStyleCssClass="even"/></asp:GridView></ContentTemplate><Triggers><atlas:ControlValueTriggerControlID="DropDownList2"PropertyName="SelectedValue"/></Triggers></atlas:UpdatePanel>

Regards,S

hello.

does this page work there:

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList runat="server" id="drop" AutoPostBack="true">
<asp:ListItem Text="True" />
<asp:ListItem Text="False" />
</asp:DropDownList>
<atlas:ScriptManager runat="server" id="manager" EnablePartialRendering="true" />
<atlas:UpdatePanel runat="server" ID="panel">
<ContentTemplate>
<%=DateTime.Now.ToString() %>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="drop" EventName="SelectedIndexChanged" />
</Triggers>
</atlas:UpdatePanel>
</form>
</body>
</html>


Hello,

yes, your example works.

In fact if I change value trigger with event trigger then my example also works.

Replace:


<atlas:ControlValueTrigger ControlID="DropDownList2" PropertyName="SelectedIndex" />

with

<atlas:ControlEventTrigger ControlID="DropDownList2" EventName="SelectedIndexChanged" />

What is wrong with ControlValueTrigger? I found this example at your page from video demonstration.

Regards,Simon


hello.

i think that replacing the controleventtrigger with the controlvaluetrigger still works in the code i've posted previouslly...doesn't it tun there when you use that trigger?


If I use your example with:

<atlas:ControlValueTrigger ControlID="drop" PropertyName="SelectedValue"/>
OR
<atlas:ControlValueTrigger ControlID="drop" PropertyName="SelectedIndex" />

It works only when selectedValue is not True, so, when you not select first option.
So, it refresh time every second attempt.

If you add more options into your example:

<asp:ListItem Text="True"/>
<asp:ListItem Text="False"/>
<asp:ListItem Text="Test"/>
<asp:ListItem Text="Test1" />

it works for all other options too, only if selectedIndex>0(if selectedValue<>"True").
Why?

Thanks,Simon


hello again.

are you saying that changing from true to false causes a partial postback but changing from false to true doesn't? that's not what i'm seeing here...btw, i've used this:

<atlas:ControlValueTrigger ControlID="drop" PropertyName="SelectedIndex" />


Yes, that is exactly what is happening.

First I change value to false and partial postback is happened.
Then I change value to True, no partial postback.
Then I change value to false, partial postback is happened.
Then I change value to True, no partial postback.
and so on...

Every change of dropdown to first choice(selectedIndex=0) creates no postback.

My code is exactly the same as yours.I copied it from here.
No master page, no any other code.
I install atlassetup.msi from

http://www.microsoft.com/downloads/details.aspx?FamilyId=B01DC501-B3C1-4EC0-93F0-7DAC68D2F787&displaylang=en

and create empty atlas web project.
Create test page and put your script into it.

Any idea? I can send you my web.cofig file and my page if you want.

Regards,Simon


hello again.

just to be sure, here's the code i'm running:

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList runat="server" id="drop" AutoPostBack="true">
<asp:ListItem Text="True" />
<asp:ListItem Text="False" />
</asp:DropDownList>
<atlas:ScriptManager runat="server" id="manager" EnablePartialRendering="true" />
<atlas:UpdatePanel runat="server" ID="panel">
<ContentTemplate>
<%=DateTime.Now.ToString() %>
</ContentTemplate>
<Triggers>
<atlas:ControlValueTrigger ControlID="drop" PropertyName="SelectedIndex" />
</Triggers>
</atlas:UpdatePanel>
<%=DateTime.Now.ToString() %>
</form>
</body>
</html>


Hello,

well my code is exact the same only that I use code behind.

So, only difference is top most line:
<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="test.aspx.cs"Inherits="test" %>

Do you know, how to include atlas into existing web application? Set references to atlas.dll and what else?

When creating new web site it's simple, just select atlas web site.

Regards,Simon


hello.

well, normally you must also add some entries on the web.config. if you look at the your atlas installation path, you'll find a web.config file that has the necessary entries. copying those entries to your web.config should be enough. you might also need to configure IIS if you're using bridges and you have not installed atlas msi on the server that is hosting your app.