Search Results

Search found 1331 results on 54 pages for 'listview'.

Page 4/54 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to scroll to the new added item in a ListView

    - by Thomas
    Hi all My application show a ListView with a button which allow user to add an element. When the user clicks on this button, another Activity is started to allow user to populate the new element. When the add is finished, we return to the previous Activity with the ListView and I would like to scroll to the new element. Note that this element is not necessarily at the end of the ListView because there is an "order by" when I retrieve the datas from the database. I know I need the cursor position of the new element to make the ListView scrool to it, but the only info I have about this element is its id, so how to convert this id to cursor position ? Do I have to loop on the cursor to find the position ? Thanks in advance

    Read the article

  • ListView control rendering issue with Groups, CheckBoxes and View mode SmallIcon

    - by volody
    Microsoft MSDN site has next remark: "Any groups assigned to a ListView control appear whenever the ListView.View property is set to a value other than View.List." My problem is that i like to have View set to SmallIcon. In this mode ListView control is shifted left, and CheckBoxes are covered by left edge How to solve this issue, or at least how is possible to shift rendering of control to the right. My OS is Windows XP Service Pack 3. It looks like that ListView items with Groups and CheckBoxes shows correctly only when View set to Details.

    Read the article

  • ListView with Groups and CheckBoxes shows correctly only when View set to Details

    - by volody
    Microsoft MSDN site has next remark: "Any groups assigned to a ListView control appear whenever the ListView.View property is set to a value other than View.List." My problem is that i like to have View set to SmallIcon In this mode ListView control is shifted left, and CheckBoxes are covered by left edge How to solve this issue, or at least how is possible to shift rendering of control to the right

    Read the article

  • JavaFX: Update of ListView if an element of ObservableList changes

    - by user1828169
    I would like to display a list of persons (coded in POJOS, and containing a name and surname property) using a JavaFX ListView control. I created the ListView and added the list of persons as an ObservableList. Everything works fine if I delete or add a new person to the ObservableList, but changes in the POJO do not trigger an update of the ListView. I have to remove and add the modified POJO from the ObservableList to trigger the update of the ListView. Is there any possibility to display changes in POJOS without the workaround described above?

    Read the article

  • Row image changes in listview in android?

    - by sunil
    Hi, I am developing an android application where I need to manipulate the background image of the rows in listview on certain conditions. Initially when the listview is loaded all works properly. But when I scroll down to the listview and come up again the background image changes. Can someone tell me the reason why its happening so? Hope to get the reply soon. Regards Sunil

    Read the article

  • Checkbox 'Checked' in ListView is restored after scrolling

    - by adrianrdzv
    I'm having the following problem: I have a ListActivity, which its ListView is composed by an icon, text and a checkbox (using LayoutInflater). The Adapter for the ListView extends ResourceCursorAdapter (i.e. the data source of the ListView is retrieved from a database, also the Checked status of each row) Everything works pretty Ok, except when I uncheck/check the checkbox in any row, if I scroll down until the modified checkbox is no longer visible, and then scroll up, the checkbox is restored to its original state. The database IS modified, this is not the problem (i.e. if I modify a row and exit the activity, and enter again, the modified row is displayed Ok). My guess is that this has something to do on how the list is rendered because for some reason the ListView "renders" the original state of all rows when it was first populated when scrolling. I've been looking around for this bug but I don't find anybody that had this problem. I appreciate any advice you have.

    Read the article

  • WPF ListView GridView DisplayMemberBinding Center alignin content

    - by Bigginn
    I'm trying to center align data in a ListView/Gridview where I use DisplayMemberBinding. This is (partially) how my gridview looks: <ListView> <ListView.View> <GridView> <GridView.Columns> <GridViewColumn DisplayMemberBinding="{Binding Path=Timi}" Width="Auto"> <GridViewColumnHeader Content="Tími" Click="GridViewColumnHeader_Click" ></GridViewColumnHeader> </GridViewColumn> </GridView.Columns> </GridView> </ListView.View> </ListView> I tried to use CellTemplate like explained on this page http://msdn.microsoft.com/en-us/library/system.windows.controls.gridviewcolumn.celltemplate.aspx but it didn't work and then later I read somewhere that one should never use cellTemplate and DisplayMemberBinding together. So the question is : How do I center the gridview data when I use DisplayMemberBinding to bind the data to the gridview? Thanks in advance.

    Read the article

  • Windows theme affecting ListView header

    - by LihO
    I've created new Windows Forms Application (C#) with one simple form containing ListView. Then I changed the View Property to Details and increased the size of the font used in this ListView and here's the result: This is how it looks on Windows XP with Windows Classic theme: and here's the result with Windows XP theme: Creating the same Windows Forms Application in Visual C++ instead of C# yields same result. EDIT : Thanks to Kamil Lach, we already know that Visual Styles is what makes the appearance of ListView change. This can be avoided either by removing Application.EnableVisualStyles() call or by changing the Application.VisualStyleState. Both of these solutions yield the following result: This looks fine, but this change affects the appearance of other controls which is not good. I'd like my ListView to be the only control that is not affected by Visual Styles. I've also found similar questions that try to deal with it: Can you turn off visual styles/theming for just a single windows control? How do I disable visual styles for just one control, and not its children? Unfortunately, none of mentioned solutions works. Any C# solution that would make the ListView header have the correct height would be appreciated.

    Read the article

  • create dynamic link buttons in ListView

    - by Sunny
    Hi, I am creating a search using listview. when user enter a word in search, I am generating a listview with the results. Now, there will be tags in each listview row. When, user clicks the tag, again a search happens using the value in the tag. There may be any number of tags for each listview row. I have to generate linkbuttons for these tags. Could anyone please guide me on how to create dynamic linkbuttons and access those values for further search. You can have a look at delicious.com. I need a similar functionality. Thanks in advance.

    Read the article

  • ListView - Index and Position Behavior upon restart()

    - by tunneling
    I am using a ListView with an ArrayAdapter that holds objects. When I select an item, I am capturing the position and index of the selected item. If I scroll down prior to selection, the position and index represent the location of the item in the list. Selecting that items takes me to another activity. When I use the back button to return to the list, it seems that the ListView get's a new position and index for the visible items. As a result, I can't figure out how to reference the selected item during the restart() of the ListView Activity. I have tried to caputure position and index, but as I've said, they change upon returning to the Activity. Is my understanding of the ListView "redraw" correct? Does it renumber my items based on what's visible? -When in the life cycle is getView() called? Is there a way to force an update to the ListView so that my caputured index still points to the same object? Thanks, Jason

    Read the article

  • Highlight the first row in a ListView and a ListBox Control

    - by Bill
    I am attempting to show both a ListView and ListBox on a Windows Form (C#). The difficulty I am having is in having the first row for both the ListView and ListBox highlighted when the application opens. Could someone please steer me in the right direction so that the first row of both the ListView and ListBox are highlighted when the application opens?

    Read the article

  • Toast on top of ListView in Android?

    - by sunil
    Hi, I have a listview in my Android Application. Now, when the user presses Next Button other contents will be loaded into the listview. What I want is that if there are no more contents available then there should be a toast displayed indicating that there are no more data available. Say, for example I have a total of 55 data available and I am displaying only 30 of them in one listview. So, when the user presses Next for the first time next 25 records will be visible. If the user again presses the Next button then a toast should be displayed on top of the last listview that had last 25 records. Currently I get an error as IndexOutOfBoundException : Invalid location 15 size is 1. Can someone suggest how is it possible? Regards Sunil

    Read the article

  • ListView in Android, handler for clicking item

    - by eljainc
    Hello, I have an activity in Android which uses a ListView. When I click on an item in the ListView, I would like to be able to determine which item was clicked. I have the following code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.listr); //setupDB(); // populateList3(); ListView lv = (ListView) findViewById(R.id.ListView01); lv.setClickable(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(ListRecords.this,"Clicked!", Toast.LENGTH_LONG).show(); } }); } My XML code: xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/Linear03lr" android:layout_width="fill_parent" android:orientation="vertical" android:gravity="center" android:layout_height="fill_parent"> android:layout_width="wrap_content" android:layout_height="400dp" / <Button android:id="@+id/previousbutton" android:gravity="center_horizontal" android:layout_width = "fill_parent" android:layout_height = "fill_parent" android:text="Previous Menu"/> </LinearLayout> What am I missing here to be able to intercept clicks on the Listview? Thanks

    Read the article

  • Getting ListView values into a string array?

    - by Andrew
    I have a ListView control set up in details mode, and on a button press I would like to retrieve all column values from that row in the ListView. This is my code so far: Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim items As ListView.SelectedListViewItemCollection = _ Me.ManageList.SelectedItems Dim item As ListViewItem Dim values(0 To 4) As String Dim i As Integer = 0 For Each item In items values(i) = item.SubItems(1).Text i = i + 1 Next End Sub But values just comes out as an empty array. Any ideas? I just want the values array to be filled with the data of that ListView row. Cheers.

    Read the article

  • Android. Searching over the listView

    - by davs
    Hi, I have activity with ListView. That listView contains imageView and two textViews (aka first and last names). I want to organize searching with this listView by one of textView (e.g. by last name). How can I implement that? I found that Quick Search Box can be used but I didn't understand how to work with it. Help, plz :)

    Read the article

  • ListView Control and Details

    - by j-t-s
    Hi All, I'm a bit confused by a few tutorials that I read about the ListView. I have a ListView control and on the left hand side should be a name, and to the right of that name should be like another column with some more text in it. For example: ListView: jason blah blah blah item2 more blahs item3 jupiter item4 uranus How can this be done? Is there a simple way of doing this? Thank you

    Read the article

  • ListView and wrap_content

    - by gaiapac
    I want to create an activity with a ListView on the left and a TextView on the right, side by side. I write the following xml, but the ListView occupies the entire page and it don't worry about the wrap_content. Why? How can I resolve it? <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <ListView android:id="@+id/lv" android:layout_width="wrap_content" android:layout_height="match_parent" /> <TextView android:id="@+id/tv" android:layout_width="wrap_content" android:layout_height="match_parent" /> </LinearLayout> EDIT: my onCreate @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView lv = (ListView) findViewById(R.id.lv); String[] values = new String[] { "Test1", "Test2", "Test3", "Test4" }; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.left, R.id.tv1, values); lv.setAdapter(adapter); }

    Read the article

  • Display images from server in listview

    - by user1451610
    My images are stored in a folder "Albums" and address for those images are "/Albums/..". i want to concatenate two strings in imageurl but its not working and listview is not displaying images:here is my code: <asp:ListView runat="server" ID="listView" OnItemDataBound="ContactsListView_ItemDataBound"> <ItemTemplate> <asp:Image ID="img" ImageUrl= '<%# String.Concat("/", Eval("PictureLink")) %>' runat="server" /> </ItemTemplate> </asp:ListView> any help?

    Read the article

  • Implementing a listview inside a sliding drawer with a listview already present

    - by Parker
    I have an app whose main class extends ListActivity: public class GUIPrototype extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final Cursor c = managedQuery(People.CONTENT_URI, null, null, null, null); String[] from = new String[] {People.NAME}; int[] to = new int[] { R.id.row_entry }; SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,R.layout.drawer,c,from,to); setListAdapter(adapter); getListView().setTextFilterEnabled(true); } } I have a sliding drawer included in my XML, and I'm trying to get a separate listview to appear in the sliding drawer. I'm trying to populate the second listview using an inflater: View inflatedView = View.inflate(this, R.layout.main, null); ListView namesLV = (ListView) inflatedView.findViewById(R.id.content); String[] names2 = new String[] { "CS 345", "New Tag", "Untagged" }; ArrayAdapter<String> bb = new ArrayAdapter<String>(this, R.layout.main, R.id.row_entry, names2); namesLV.setAdapter(bb); This compiles, and runs, but the slidingdrawer is completely blank. My XML follows: <SlidingDrawer android:id="@+id/drawer" android:handle="@+id/handle" android:content="@+id/content" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="bottom"> <ImageView android:id="@id/handle" android:layout_width="48px" android:layout_height="48px" android:background="@drawable/icon"/> <ListView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@id/content"/> </SlidingDrawer> I feel like I'm missing a vital step. I haven't found any resources on my problem by Googling, so any help would be greatly appreciated.

    Read the article

  • Problem in databinding a dictionary in ListView combo-box column.

    - by Ashish Ashu
    I have a listview of which itemsource is set to my custom collection, let's say MyCollection. The code below is not full code , it's just a code snippets to explain the problem. class Item : INotifyPropertyChanged { Options _options; public Options OptionProp { get { return _options; } set { _options = value; OnPropertyChanged ("OptionProp");} } string _Name; public string NameProp { get { return _Name; } set { _Name = value; OnPropertyChanged ("NameProp");} } } class Options : Dictionary<string,string> { public Options() { this.Clear(); this.Add("One" , "1" ); this.Add("Two" , "2" ); this.Add("Three" , "3" ); } } MyCollection in my viewModel class viewModel { ObservableCollection<Item> **MyCollection**; KeyValuePair<sting,string> **SelectedOption**; } The listview Item Source is set to my MyCollection. <ListView ItemSource = MyCollectoin> I Listview contains two columns of which I have defined a datatemplats in the listview. First column is a combo-box of which Itemsource is set to Options ( defined above ) Second column is a simple textblock to display Name. Problem 1. I have defined a datatemplate for first column in which I have a combo box , I have set the Itemsource =**MyCollection** and SelectedItem = SelectedOption of the combo-box. User can perform following operations in the listview: Add ( Add the row in the listview ) Move Up ( Move row up in the listview ) Move Down ( Move down the item in the listview ) .Now when I add the row in the listview , the combo-box selected index is always comes to -1 (first column). However the combo box contains options One, Two and Three. Also, I have initialized the SelectedOption to contain the first item, i:e One. problem 2. . Let suppose, I have added a single row in a listview and I have selected Option "one" in the combo box manually. Now when I perform Move Up or Move Down operations the selected index of a combo box is again set to -1. In the Move Up or Move Down operation , I am calling MoveUp and MoveDown methods of the Observable collection. Probelm 3 How to serialize the entire collection in XML. Since I can't serialize the Dictionary and KeyValue Pair. I have to restore the state of the listview.

    Read the article

  • Converting listview to a composite control

    - by Paul
    The link below shows a listview composite control in its most basic form however I can't seem to extend this to what I'm trying to do. http://stackoverflow.com/questions/92689/how-to-define-listview-templates-in-code My listview has 1 tablerow with 2 fields. The first field contains 1 element whilst the second field contains 2 elements as shown below. <asp:ListView ID="lstArticle" runat="server"> <LayoutTemplate> <table id="itemPlaceholder" runat="server"> </table> </LayoutTemplate> <ItemTemplate> <div class="ctrlArticleList_rptStandardItem"> <table width="100%"> <tr> <td valign="top" class="ctrlArticleList_firstColumnWidth"> <a href="<%# GetURL(Container.DataItem) %>"> <%# GetImage(Container.DataItem)%> </a> </td> <td valign="top"> <span class="ctrlArticleList_title"> <a href="<%# GetURL(Container.DataItem) %>"> <%# DataBinder.Eval(Container.DataItem, "Title") %> </a> </span> <span class="ctrlArticleList_date"> <%# convertToShortDate(DataBinder.Eval(Container.DataItem, "ActiveDate"))%> </span> <div class="ctrlArticleList_standFirst"> <%# DataBinder.Eval(Container.DataItem, "StandFirst")%> </div> </td> </tr> </table> </div> </ItemTemplate> So to convert this I have to use the InstantiateIn method of the ITemplate for the layouttemplate and the ItemTemplate. Data is bound to the itemtemplate using the DataBinding event. My question at the moment is how do I setup the ItemTemplate class and bind the values from the above ListView ItemTemplate. This is what I've managed so far: private class LayoutTemplate : ITemplate { public void InstantiateIn(Control container) { var table = new HtmlGenericControl("table") { ID = "itemPlaceholder" }; container.Controls.Add(table); } } private class ItemTemplate : ITemplate { public void InstantiateIn(Control container) { var tableRow = new HtmlGenericControl("tr"); //first field in row var tableFieldImage = new HtmlGenericControl("td"); var imageLink = new HtmlGenericControl("a"); imageLink.ID = "imageLink"; tableRow.Controls.Add(imageLink); // second field in row var tableFieldTitle = new HtmlGenericControl("td"); var title = new HtmlGenericControl("a"); tableFieldTitle.Controls.Add(title); tableRow.Controls.Add(tableFieldTitle); //Bind the data with the controls tableRow.DataBinding += BindData; //add the controls to the container container.Controls.Add(tableRow); } public void BindData(object sender, EventArgs e) { var container = (HtmlGenericControl)sender; var dataItem = ((ListViewDataItem)container.NamingContainer).DataItem; container.Controls.Add(new Literal() { Text = dataItem.ToString() }); } One of the functions in the ListView just for an example is: public string GetURL(object objArticle) { ArticleItem articleItem = (ArticleItem)objArticle; Article article = new Article(Guid.Empty, articleItem.ContentVersionID); return GetArticleURL(article); } Summary What do I need to do to convert the following into a composite control: 1. <a href="<%# GetURL(Container.DataItem) %>"><%# GetImage(Container.DataItem)%></a> 2. <a href="<%# GetURL(Container.DataItem) %>"> <%# DataBinder.Eval(Container.DataItem, "Title") %> </a>

    Read the article

  • Using AsyncTask to display data in ListView, but onPostExecute not being called

    - by sumisu
    I made a simple AsyncTask class to display data in ListView with the help of this stackoverflow question. But the AsyncTask onPostExecute is not being called. This is my code: public class Start extends SherlockActivity { // JSON Node names private static final String TAG_ID = "id"; private static final String TAG_NAME = "name"; // category JSONArray JSONArray category = null; private ListView lv; @Override public void onCreate(Bundle savedInstanceState) { setTheme(SampleList.THEME); //Used for theme switching in samples super.onCreate(savedInstanceState); setContentView(R.layout.test); new MyAsyncTask().execute("http://...."); // Launching new screen on Selecting Single ListItem lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // getting values from selected ListItem String name = ((TextView) view.findViewById(R.id.name)).getText().toString(); String cost = ((TextView) view.findViewById(R.id.mail)).getText().toString(); // Starting new intent Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class); in.putExtra("categoryname", name); System.out.println(cost); in.putExtra("categoryid", cost); startActivity(in); } }); } public class MyAsyncTask extends AsyncTask<String, Void, ArrayList<HashMap<String, String>> > { // Hashmap for ListView ArrayList<HashMap<String, String>> contactList = new ArrayList<HashMap<String, String>>(); @Override protected ArrayList<HashMap<String, String>> doInBackground(String... params) { // Creating JSON Parser instance JSONParser jParser = new JSONParser(); // getting JSON string from URL category = jParser.getJSONArrayFromUrl(params[0]); try { // looping through All Contacts for(int i = 0; i < category.length(); i++){ JSONObject c = category.getJSONObject(i); // Storing each json item in variable String id = c.getString(TAG_ID); String name = c.getString(TAG_NAME); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(TAG_ID, id); map.put(TAG_NAME, name); // adding HashList to ArrayList contactList.add(map); } } catch (JSONException e) { Log.e("log_tag", "Error parsing data "+e.toString()); } return contactList; } @Override protected void onPostExecute(ArrayList<HashMap<String, String>> result) { ListAdapter adapter = new SimpleAdapter(Start.this, result , R.layout.list_item, new String[] { TAG_NAME, TAG_ID }, new int[] { R.id.name, R.id.mail }); // selecting single ListView item lv = (ListView) findViewById(R.id.ListView); lv.setAdapter(adapter); } } } Eclipse: 11-25 11:40:31.896: E/AndroidRuntime(917): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.essentials/de.main.Start}: java.lang.NullPointerException

    Read the article

  • ListView not firing OnItemCommand after preventing postback

    - by nevizi
    Hi there, I have a ListView inside a FormView that, for some strange reason, doesn't fire neither the ItemInsert nor the ItemCommand event. I'm populating the ListView with a generic list. I bind the list to the ListView on the OnPreRenderComplete. <asp:ListView runat="server" ID="lvReferences" DataKeyNames="idReference" OnItemInserting="ContractReferences_Inserting" OnItemDeleting="ContractReferences_Deleting" InsertItemPosition="LastItem" OnItemCommand="ContractReferences_Command" OnItemCreated="ContractReferences_ItemDataBound"> <LayoutTemplate> <ul> <asp:PlaceHolder ID="itemPlaceholder" runat="server" /> </ul> </LayoutTemplate> <ItemTemplate> <li class="obsItem"> <a href="#"><asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" Text='<%#Bind("idProcessRecordRef") %>' /></a> <asp:TextBox id="txtRef" runat="server" Text='<%#Bind("description") %>' /> <asp:ImageButton ID="btDelete" runat="server" CommandName="Delete" ImageUrl="~/_layouts/web.commons/Images/eliminar.png" /> </li> </ItemTemplate> <InsertItemTemplate> <li class="obsItem"> <a href="#"><asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" /></a> <asp:TextBox id="txtRef" runat="server" /> <asp:ImageButton ID="btDetail" CausesValidation="false" OnClientClick="javascript:openPopup();return false;" runat="server" ImageUrl="~/_layouts/web.commons/Images/novo.png" /> <asp:ImageButton ID="btSaveDs" runat="server" CommmandName="Insert" CausesValidation="false" ImageUrl="~/_layouts/web.commons/Images/gravarObs.png" /> </li> </InsertItemTemplate> </asp:ListView> My ItemDataBound method is: protected void ContractReferences_ItemDataBound(object sender, ListViewItemEventArgs e) { if (!IsPostBack) { TextBox valRef = e.Item.FindControl("valRef") as TextBox; TextBox txtRef = e.Item.FindControl("txtRef") as TextBox; ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "function openPopup(){ window.open('ContractPicker.aspx?c1=" + valRef.ClientID + "&c2=" + txtRef.ClientID + "');}", true); } } So, basically, in the InsertItemTemplate I put a button that opens a LOV and populates my valRef and txtRef fields. I had to put a "return false" in order for the parent page to not postback (and I think the problem lies here...). Then, when I click in the ImageButton with the CommandName="Insert", instead of firing the ItemCommand event, it enters once again in the ItemDataBound handler. So, any ideas? Thanks!

    Read the article

  • ListView not firing OnItemCommand (nor ItemInserting) after preventing postback

    - by nevizi
    Hi there, I have a ListView inside a FormView that, for some strange reason, doesn't fire neither the ItemInsert nor the ItemCommand event. I'm populating the ListView with a generic list. I bind the list to the ListView on the OnPreRenderComplete. <asp:ListView runat="server" ID="lvReferences" DataKeyNames="idReference" OnItemInserting="ContractReferences_Inserting" OnItemDeleting="ContractReferences_Deleting" InsertItemPosition="LastItem" OnItemCommand="ContractReferences_Command" OnItemCreated="ContractReferences_ItemDataBound"> <LayoutTemplate> <ul> <asp:PlaceHolder ID="itemPlaceholder" runat="server" /> </ul> </LayoutTemplate> <ItemTemplate> <li class="obsItem"> <a href="#"><asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" Text='<%#Bind("idProcessRecordRef") %>' /></a> <asp:TextBox id="txtRef" runat="server" Text='<%#Bind("description") %>' /> <asp:ImageButton ID="btDelete" runat="server" CommandName="Delete" ImageUrl="~/_layouts/web.commons/Images/eliminar.png" /> </li> </ItemTemplate> <InsertItemTemplate> <li class="obsItem"> <a href="#"><asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" /></a> <asp:TextBox id="txtRef" runat="server" /> <asp:ImageButton ID="btDetail" CausesValidation="false" OnClientClick="javascript:openPopup();return false;" runat="server" ImageUrl="~/_layouts/web.commons/Images/novo.png" /> <asp:ImageButton ID="btSaveDs" runat="server" CommmandName="Insert" CausesValidation="false" ImageUrl="~/_layouts/web.commons/Images/gravarObs.png" /> </li> </InsertItemTemplate> </asp:ListView> My ItemDataBound method is: protected void ContractReferences_ItemDataBound(object sender, ListViewItemEventArgs e) { if (!IsPostBack) { TextBox valRef = e.Item.FindControl("valRef") as TextBox; TextBox txtRef = e.Item.FindControl("txtRef") as TextBox; ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "function openPopup(){ window.open('ContractPicker.aspx?c1=" + valRef.ClientID + "&c2=" + txtRef.ClientID + "');}", true); } } So, basically, in the InsertItemTemplate I put a button that opens a LOV and populates my valRef and txtRef fields. I had to put a "return false" in order for the parent page to not postback (and I think the problem lies here...). Then, when I click in the ImageButton with the CommandName="Insert", instead of firing the ItemCommand event, it enters once again in the ItemDataBound handler. So, any ideas? Thanks!

    Read the article

  • WPF ListView Data Binding wont synchronize

    - by Aviatrix
    my listview will display only the item that its added by the constructor and it wont add the items that i add dynamically public class PostList : ObservableCollection<PostData> { public PostList() : base() { Add(new PostData("Isak", "Dinesen")); // Add(new PostData("Victor", "Hugo")); // Add(new PostData("Jules", "Verne")); } public void AddToList (string[] data){ string username2, msg; msg = data[0]; username2 = data[1]; Add(new PostData(msg, username2)); } } public class PostData { private string Username; private string Msg; private string Avatar; private string LinkAttached; private string PicAttached; private string VideoAttached; public PostData(string msg ,string username, string avatar=null, string link=null,string pic=null ,string video=null) { this.Username = username; this.Msg = msg; this.Avatar = avatar; this.LinkAttached = link; this.PicAttached = pic; this.VideoAttached = video; } public string pMsg { get { return Msg; } set { Msg = value; } } public string pUsername { get { return Username; } set { Username = value; } } ..... ..... } Xaml <ListView x:Name="PostListView" BorderThickness="0" MinHeight="300" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}" VerticalContentAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" IsSynchronizedWithCurrentItem="True" MinWidth="332" SelectedIndex="0" SelectionMode="Extended" AlternationCount="1" ItemsSource="{Binding Source={StaticResource PostListData}}"> <ListView.ItemTemplate> <DataTemplate> <DockPanel x:Name="SinglePost" VerticalAlignment="Top" ScrollViewer.CanContentScroll="True" ClipToBounds="True" Width="333" Height="70" d:LayoutOverrides="VerticalAlignment" d:IsEffectDisabled="True"> <StackPanel x:Name="AvatarNickHolder" Width="60"> <Label x:Name="Nick" HorizontalAlignment="Center" Margin="5,0" VerticalAlignment="Top" Height="15" Content="{Binding Path=pUsername}" FontFamily="Arial" FontSize="10.667" Padding="5,0"/> <Image x:Name="Avatar" HorizontalAlignment="Center" Margin="5,0,5,5" VerticalAlignment="Top" Width="50" Height="50" IsHitTestVisible="False" Source="1045443356IMG_0972.jpg" Stretch="UniformToFill"/> </StackPanel> <TextBlock x:Name="userPostText" Margin="0,0,5,0" VerticalAlignment="Center" FontSize="10.667" Text="{Binding Path=pMsg}" TextWrapping="Wrap"/> </DockPanel> </DataTemplate> </ListView.ItemTemplate> </ListView>

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >