Messages - h0meopathic [ switch to compact view ]

Pages: [1] 2 3 4 5next
1
I want to filter data at the codebehind layer in a drop down list control, but I'm unsure how I would do that. I looked around on how to do this but couldn't find anything. Any help is welcome. Thanks!

2
Developer's Corner / Rearranging one item within a dataset
« on: December 15, 2009, 12:55 PM »
I've got a list of people coming in from a stored procedure alphabetically, stored in a dataset, bound to a custom datasource, then displayed in the order that they came in

on.
Code: C# [Select]
  1. protected void gvPhotoGrid_OnItemDataBound(object sender, DataListItemEventArgs e)
  2.     {
  3.         if (e.Item.ItemType == ListItemType.AlternatingItem | e.Item.ItemType == ListItemType.Item)
  4.         {
  5.             Label l = (Label)e.Item.FindControl("lblTitle");
  6.            
  7.             if (l != null)
  8.             {
  9.                 string strval = l.Text;
  10.                 string title = _title;
  11.  
  12.                 if (title == strval)
  13.                 {
  14.                     l.Text = "";
  15.                     e.Item.Visible = false;
  16.                 }
  17.                 else
  18.                 {
  19.                     title = strval;
  20.                     _title = title;
  21.                     l.Text = "<br/>" + title;
  22.                     e.Item.Visible = true;
  23.                 }
  24.             }
  25.         }
  26.     }

My problem is, two people got a divorce and can't be next to each other. They both have the same last name so by default they would come in to the list right next to each other. So, what would be the logic to display one of the people on the list in a different location without putting them at the bottom or top?

Code: HTML [Select]
  1. <asp:DataList ID="gvPhotoGrid" runat="server">
  2.                 <ItemTemplate>
  3.                 <tr id='<%# Eval("DiaLevelName") %>' align="center">
  4.                     <td colspan="2"><asp:Label ID="lblTitle" Font-Underline="true" Font-Bold="true" runat="server" Text='<%# Bind("DiaLevelName") %>' Visible="true" ></asp:Label>
  5.                     <br />
  6.                     <br />
  7.                     </td>
  8.                 </tr>
  9.                 <tr align="center">
  10.                     <td><a href='<%# ResolveUrl("gemProfile.aspx?gemid=" + Eval("userID") + "&Name=" + Eval("calendarSearch")) %>'>
  11.                                         <asp:Image BorderWidth="0px" ID="Image1" runat="server" AlternateText='<%# Eval("userName") %>'
  12.                                                     ImageUrl='<%#  ResolveUrl("~/images/gemImages/" + Eval("gemImage")) %>' />
  13.                                     </a>
  14.                                     <br />
  15.                                     <asp:Label runat="server" ID="lblName" Text='<%# Eval("userName") %>' />
  16.                                     <br />
  17.                                     <br />
  18.                     </td>
  19.                 </tr>
  20.                 </ItemTemplate>
  21.                 </asp:DataList>

3
Developer's Corner / Reusing a Custom Gridview Control
« on: October 21, 2009, 02:52 PM »
Greetings!

I've created a Custom Control with a gridview in it. I designed it for page X but I also want to put the control in page Y. However, I set the gridview datasource in the control for what I wanted to display in X, but I need a different datasource in page Y. My Boss tells me I need to expose a property or method that would allow me to pass the datasource in. I haven't a clue where or how to do that.

Any thoughts?

4
Code: C# [Select]
  1. SqlConnection conn;
  2.         DataSet dataSet = new DataSet();
  3.         SqlDataAdapter adapter;
  4.         SqlCommandBuilder commandBuilder;
  5.  
  6.         conn = new SqlConnection("Server=localhost\\SqlExpress; Database=HealthFair;" +
  7.                 "Integrated Security = True");
  8.         adapter = new SqlDataAdapter("SELECT Slot, COUNT(Slot) AS SlotCount FROM AppointmentName " +
  9.             "GROUP BY Slot HAVING COUNT(Slot) > 1", conn);
  10.         adapter.Fill(dataSet);
  11.         commandBuilder = new SqlCommandBuilder(adapter);
  12.         adapter.Update(dataSet);

Now how do I get the data into objects so I can determin which records in Slots to cut off?

5
I figured it out, thanks for the help.

Code: Text [Select]
  1. SELECT Slot, COUNT(Slot)
  2. AS SlotCount
  3. FROM AppointmentName
  4. GROUP BY Slot

Pages: [1] 2 3 4 5next
Go to full version