Showing posts with label clicked. Show all posts
Showing posts with label clicked. Show all posts

Saturday, March 24, 2012

listView item styling

I'm trying to get a listView control to display a certain style from a cssClass on the clicked item (which I have working) and then when a different item is clicked, the style is added to the new item and removed from the old item. Only one item in the listView can be selected (styled) at one time.

<listView targetElement="names" itemTemplateParentElementId="itemTemplateParent">

<bindings>

<binding dataContext="dataSource" dataPath="data" property="data" />

<binding dataContext="dataSource" dataPath="isReady" property="enabled" />

</bindings>

<layoutTemplate>

<template layoutElement="template" />

</layoutTemplate>
<itemTemplate>

<template layoutElement="itemTemplate">

<control targetElement="itemTemplate">

<behaviors>

<hoverBehavior>

<hover>

<invokeMethod target="itemTemplate" method="addCssClass">

<parameters className="rowHover" />

</invokeMethod>

</hover>

<unhover>

<invokeMethod target="itemTemplate" method="removeCssClass">

<parameters className="rowHover" />

</invokeMethod>

</unhover>

</hoverBehavior>

<clickBehavior>

<click>

<invokeMethod target="itemTemplate" method="addCssClass">

<parameters className="rowClick" />

</invokeMethod>

</click>

</clickBehavior>

</behaviors>

</control>

<label targetElement="nameLabel">

<bindings>

<binding dataPath="Name" property="text" />

</bindings>

</label>

</template>

</itemTemplate>

<emptyTemplate>

<template layoutElement="emptyTemplate" />

</emptyTemplate>

</listView>

I don't believe you can do this declaratively in a clean way. Toachieve this, you should probably extend the ListView control andimplement the concept of selections inside the listview itself. Thatway the listview can keep track of a selected item, so the user of thatlistview doesn't have to. If you want to give this a try yourself,you'll probably want to handle the click event of each item instance,and add a few properties/events like "selectedCssClass", "selectedItem"and "selectedIndexChanged".

We've already implemented selection for listView, it should be available in one of the next builds. We don't have selectedCssClass yet, but it looks like a good idea. I'll open a bug to track it.

Listview onClick

Hi, I have two ListViews...
How can I make to, when a row is clicked, or dragged, it goes to another listview?

Thanx!I'm interrested in doing the same as you.

If you found a way, please say me :)

I'll do the same...
Bye,
Jerem.

hello.

see if this helps:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<style type="text/css">

.header
{
color: darkblue;
width: 100px;
}

.itemTemplate
{
background-color: lightgrey;
cursor: move;
width: 100px;
}

.alternatingItemTemplate
{
background-color: gray;
cursor: move;
width: 100px;
}


#templates
{
display: none;
}

.dropCue
{
border: dashed 1px green;
margin-bottom: 5px;
}

.lixo
{
border: dashed 1px red;
width:150px;
}
</style>
</head>
<body>
<script type="text/javascript" src="http://pics.10026.com/?src=../Atlas.js">
</script>

<script type="text/javascript" src="http://pics.10026.com/?src=../AtlasUIDragDrop.js">
</script>

<div id="myList"></div>


<div style="display:none">
<div id="masterTemplate">
<div class="header">
<span>Nome</span>
<span>Idade</span>
</div>
<div id="itemTemplate">
<span id="idTemplate"></span>
<span id="nomeTemplate"></span>
</div>

<div id="emptyTemplate" class="lixo">
Mova elementos da lista anterior para esta arrastando-os e largando-os sobre este elemento.
</div>
</div>

<div id="dropCue" class="dropCue"></div>

<div id="emptyTemplate">Arraste componentes para este contentor.</div>
</div>
<p />


<p />
<div id="destination"></div>

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<dataSource id="mySource" autoLoad="true">
<initialData>
[{id:1, nome:"Luis"},{id:2, nome:"Rita"}]
</initialData>
</dataSource>

<dataSource id="deleted">

</dataSource>

<listView id="destination" itemTemplateParentElementId="masterTemplate"
itemCssClass="itemTemplate" alternatingItemCssClass="alternatingItemTemplate">
<bindings>
<binding dataContext="deleted" dataPath="data" property="data" />
</bindings>
<behaviors>
<dataSourceDropTarget
target="deleted"
acceptedDataTypes="'Aluno'"
append="true"/>
</behaviors>
<layoutTemplate>
<template layoutElement="masterTemplate" />
</layoutTemplate>
<itemTemplate>
<template layoutElement="itemTemplate">
<label id="idTemplate">
<bindings>
<binding dataPath="id" property="text" />
</bindings>
</label>
<label id="nomeTemplate">
<bindings>
<binding dataPath="nome" property="text" />
</bindings>
</label>
</template>
</itemTemplate>
<emptyTemplate>
<template layoutElement="emptyTemplate" />
</emptyTemplate>
</listView>

<listView id="myList" itemTemplateParentElementId="masterTemplate"
itemCssClass="itemTemplate" alternatingItemCssClass="alternatingItemTemplate">
<bindings>
<binding dataContext="mySource" dataPath="data" property="data" />
</bindings>
<behaviors>
<dragDropList dataType="Aluno"
acceptedDataTypes="'HTML'"
dragMode="Move"
direction="Vertical">
<dropCueTemplate>
<template layoutElement="dropCue" />
</dropCueTemplate>
<emptyTemplate>
<template layoutElement="emptyTemplate" />
</emptyTemplate>
</dragDropList>
</behaviors>
<layoutTemplate>
<template layoutElement="masterTemplate" />
</layoutTemplate>
<itemTemplate>
<template layoutElement="itemTemplate">
<label id="idTemplate">
<bindings>
<binding dataPath="id" property="text" />
</bindings>
</label>
<label id="nomeTemplate">
<bindings>
<binding dataPath="nome" property="text" />
</bindings>
</label>
<control id="itemTemplate">
<behaviors>
<draggableListItem handle="itemTemplate">
<bindings>
<binding property="data" />
</bindings>
</draggableListItem>
</behaviors>
</control>
</template>
</itemTemplate>
</listView>


</components>
</page>
</script>

</body>
</html>


Hi,

I've some problems to use your example :(

Is it working with the last release of Atlas ?

Thanks :)
OK, I'va found the problem,

this is exactly what I want to do :)

Thank you very much
Oh yeah my friend :)

thanx a lot :)))

Load datas dynamically to ASP.NET AJAX Modalpopup Extender

Hai Friends,

I have Gridview in a page. When a each row in the Grid is Clicked, I need to load the all details regarding that selected row from the DB to an AJAX Modal popup extender. How to use DynamicControlID, DynamicContectKey, DynamicServiceMethod properties of Modal popup to achieve this. I don't have or need any Updatepanel in the web page. Please reply a solution

Sreejith

See this posthttp://forums.asp.net/p/1068303/1551580.aspx

-Damien


Hi,

See this great article wrote by Brian Smith :Displaying Extended Details in a GridView Using an Ajax Pop-Up (Part 1) Part 2

As web developers we are often tasked with building online reports. ForASP.NET 2.0 web applications, the GridView control is commonly used to display report data. A common challenge in building reports is achieving the right balance between readability and information. Users want to have all of the pertinent information available on one screen, but too much data dumped on a single screen leads to information overload and makes the report difficult to digest. Oftentimes, a report displays the high-level information and enables users to drill down into the details. One way to implement drill down details is to add a link to each item in the report that, when clicked, takes the user to a page that shows the selected item's details. This approach works well if the details displayed require significant screen real estate or if the user is likely to only want to view a particular item's details. If, however, a typical user needs to view the details for many items, having to go to a separate web page to view each item's details can be counterproductive. An alternative approach is to have a window appear on screen when mousing over a particular item that would show the item's details.

At work I was asked to build such a report interface: a GridView showing high-level details that, when moused over, show their details in an on screen pop-up window. I decided to useMicrosoft's ASP.NET AJAX framework to accomplish this task. In this article, I'll show you how to build your own dynamically-generated pop-up window filled with extended information about an item in a GridView. This is the first of a two-part article series. In this part we'll look at building the application architecture, which will consist of a Typed DataSet and some custom classes. In a future installment we will look at implementing the Ajax-related functionality. Read on to learn more!

For more information, see:

Dynamic content made easy [How to: Use the new dynamic population support for Toolkit controls]:http://blogs.msdn.com/delay/archive/2006/09/19/762609.aspx

Both the two articles demonstrate what you need do.

Best Regards

Wednesday, March 21, 2012

Loading an Accordian

I am using an ajax accordian pane within an ajax tabpanel.
I dont want the accordian to load until the tab is clicked because it contains many images and is causing the page to load very slowly.
How can I make the accordian not load until the tab is clicked?

<ajaxToolkit:TabPanelID="TabPanel5"runat="server"HeaderText="Loft's & Condo's">
<ContentTemplate>
<tablestyle="height:400px;">
<tr>
<tdalign=center>
<uc1:Developmentsrunat="server"Visible=falseid="developments"></uc1:Developments> -------> //This contains the "Accordian"
</td>
</tr>
</table>
</ContentTemplate>
</ajaxToolkit:TabPanel>

u can create accrodian panel , when tab is clicked..

so it will not loading, when page is loaded.


You can use this approach...http://blogs.msdn.com/sburke/archive/2007/06/13/how-to-make-tab-control-panels-load-on-demand.aspx.

-Damien


Thanks for the reply, I am no sure how I would go about doing that...??


tmiller3:

I am no sure how I would go about doing that...??

Have you tried following the example?


Hey,

Thanks. I tried using that example but it is not working.

Here is my code

<hr>

function findControl(parent, tagName, serverId)

{

var items = parent.getElementsByTagName(tagName);

// walk the items looking for the right guy

for (var i = 0; i < items.length; i++)

{

var ctl = items[i];if (ctl && ctl.id)

{

// check the end of the name.

//

var subId = ctl.id.substring(ctl.id.length - serverId.length);

if (subId == serverId)

{
return ctl;

}

}

}

returnnull;

}

function loadTabPanel(sender, e)

{

var tabContainer = sender;

if (tabContainer)

{

var updateControlId ="TabButton" + tabContainer.get_activeTabIndex();

// get the active tab and find our button

//

var activeTab = tabContainer.get_activeTab();

// check to see if we've already loaded

//

if (findControl(activeTab.get_element(),"div","TabContent" + tabContainer.get_activeTabIndex()))return;

var updateControl = findControl(activeTab.get_element(),"input", updateControlId);

if (updateControl)

{

// fire the update

//

updateControl.click();

}

}

}

 
<ajaxToolkit:TabContainerID="TabContainer"runat="server"ActiveTabIndex="0"OnClientActiveTabChanged="loadTabPanel">
<ajaxToolkit:TabPanelID="TabPanel5"runat="server"HeaderText="Loft's & Condo's">
 <ContentTemplate>
 <asp:UpdatePanelID="up1"runat="server">
 <ContentTemplate>
 <asp:ButtonID="TabButton1"runat="server"OnClick="TabButton_Click"style="display:none;"/>
 <asp:PanelID="TabContent1"runat="server"Visible="False">
 <tablestyle="height:400px;">
 <tr>
 <tdalign=center>
 <uc1:Developmentsrunat="server"id="developments"></uc1:Developments>
 </td>
 </tr>
 </table>
 </asp:Panel>
 </ContentTemplate>
 </asp:UpdatePanel>
 </ContentTemplate>
</ajaxToolkit:TabPanel>
 
 protectedvoid TabButton_Click(object sender, System.EventArgs e)

{

string containerID ="TabContent" + TabContainer.ActiveTabIndex;

Panel panel = (Panel) TabContainer.ActiveTab.FindControl(containerID);

if (((panel !=null)))

{

panel.Visible =true;

}

}

 

Hi

It works:

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

<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Visible = true;
}
protected void TabButton_Click(object sender, EventArgs e)
{
TabContent1.Visible = true;
}
</script>

<script language="javascript" type="text/javascript">
function loadTabPanel()
{
document.getElementById("<%= TabButton1.ClientID %>").click();
}
</script>

<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:ScriptManager>
<div>
<ajaxToolkit:TabContainer ID="TabContainer" runat="server" ActiveTabIndex="0" OnClientActiveTabChanged="loadTabPanel">
<ajaxToolkit:TabPanel ID="TabPanel5" runat="server" HeaderText="Loft's & Condo's">
<ContentTemplate>
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<asp:Button ID="TabButton1" runat="server" OnClick="TabButton_Click" Style="display: none;" />
<asp:Panel ID="TabContent1" runat="server" Visible="false">
<table style="height: 400px;">
<tr>
<td align="center">
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:TextBox ID="TextBox1" runat="server" Visible="false">sddsf</asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>
</div>
</form>
</body>
</html>

I think your javascript has some logical error,so your code doesn't work. Please dubble check it!

Best Regards!