topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 6:26 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - h0meopathic [ switch to compact view ]

Pages: [1]
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
I have 36 radio buttons in a form, all with the same groupName, and all with different IDs.  Is it possible to find out which ID is selected without fishing for it? Surely a dynamic control such as a radiobutton wouldn't have been made without a simple way of finding out which button was selected.

5
I need a way to check my database and see if a record is repeated and if it's repeated twice.

I'm making a webform that will allow the user to enter his or her personal information and select a radio button of specific times.  The radio button will correspond to a SlotID in my database. When the SlotID has been used twice I need to grey out the radio button because it can no longer be selected. Any help would be nice.

6
ASP.NET / Simple form using visual web developer
« on: July 24, 2009, 02:58 PM »
I'm trying to learn the basics and to do a project. The project requires that I have a web form which allows the user to input their name and such and hit the submit button. Upon hitting the submit button the information is sent to the database. I have a database ready to go, a datalayer but i'm unsure about sending the information. I've been able to view the table through gridview but not much else.

I've been looking for a tutorial to do just what i'm trying to do in my project but haven't got much luck. If i could just get the skinny doing something as simple as inputting a name in a textbox, pressing submit, and the string from the textbox shoing up in the appropriate field in the db table, that would be awesome and I could figure out the rest.

7
Developer's Corner / multi answer multi choice database
« on: March 24, 2009, 07:51 PM »
I'm making a survey and I have to be able to allow the surveyee to check more than one option from the multiple choice answer. I've made a single answer multiple choice answer php page behind a database, but I'm not quite sure about the multi choice option.

I'm sure I can make the php part work, but i'm not sure how I'd get both answers in the database in a neat fashion.

Any thoughts?

8
http://www.devx.com/...ticle/27175/0/page/2

Code: PHP [Select]
  1. <?php
  2. // Connect to the database server Make sure not to use a 'blank' root password
  3. // the way that I am doing here! :)
  4. $dbconn = @mysql_connect('mysql6.000webhost.com', 'a8784371_kyle', 'xxx');
  5. if (!$dbconn)
  6. {
  7.         die('Error connecting to DB!');
  8. }
  9. // Find the surveys db
  10. if (! @mysql_select_db('a8784371_surveys') )
  11. {
  12.         die( '<p>Unable to locate the main database at this time.</p>' );
  13. }
  14.  
  15. // This page requires a URL parameter with the QuestionID.
  16. if(isset($_GET["QuestionID"]))
  17.         $Qid = $_GET["QuestionID"];
  18. else
  19.         die("Please set a question id in the URL");
  20.  
  21. // Get the Question text corresponding to this ID      
  22. $Sql = "Select * from Questions where QuestionID=" . $Qid;
  23. $result= mysql_query($Sql) or die(mysql_error());
  24. $row = mysql_fetch_row($result);
  25. // The text of the Question is in Column 1
  26. $QText = $row[1];
  27.  
  28. // Get the options for this question.
  29. $Sql2 = "Select * from Options where QuestionID=" . $Qid;
  30. $OptResult = mysql_query($Sql2) or die(mysql_error());
  31. // Write out the HTML for the page
  32. ?>
  33. <html>
  34. <head>
  35. <meta http-equiv="Content-Language" content="en-us">
  36. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  37. <title>Test 1</title>
  38. <style>
  39. <!--
  40. .BulletText  
  41. { font-family: Verdana; font-size: 8pt;
  42.   text-align: left; line-height: 100%;
  43.   word-spacing: 0; margin-top: 0; margin-bottom: 0 }
  44. -->
  45. </style>
  46. </head>
  47.  
  48. <body>
  49. <!-- ---------------------------------------------------------------
  50. The question is going to be a HTML form. The form will be generated by
  51. this PHP script. It will be a paragraph of text containing the question
  52. followed by n radio buttons, with each being the options associated with
  53. the question. Finally, there will be a hidden button containing the
  54. Question ID (so it can be passed onto the form processor)
  55. ------------------------------------------------------------------>
  56. <form method="POST" action="process.php">
  57.  <!-- Write out the question Text -->
  58.  <p><?php echo($QText)?></p>
  59.  <?
  60.  $nVal = 0;
  61.  while  ($optrow = mysql_fetch_array($OptResult))
  62.   {
  63.    if($nVal==0)
  64.    // The First Option will be checked.
  65.    echo("<p class='BulletText'><input type='radio' value='" .
  66.      $nVal . "' checked name='Q' id='Q'>" . $optrow[2] . "</p>");
  67.    else
  68.    // The Others Won't
  69.    echo("<p class='BulletText'><input type='radio' value='" . $nVal
  70.      . "' name='Q' id='Q'>" . $optrow[2] . "</p>");
  71.   $nVal++;
  72.   }
  73.  ?>
  74.  <p><input type="hidden" value="<?php echo($Qid); ?>" name="QID"/></p>
  75.  <p><input type="submit" value="Submit" name="B1">
  76.  <input type="reset" value="Reset" name="B2"></p>
  77. </form>
  78. </body>
  79. </html>
I view my php file in the browser using http://istem.comyr.com/survey.php (this is were the file is stored)

The code is executed until the php requests the "questionid" and I get the controlled error message, "Please set a question id in the URL".

By the code above I'm pretty sure that I'm getting into the database correctly.

The tutorial site tells me that I should call the page using example, http://yourserver/su...vey.php?questionid=1.

So I do http://istem.comyr.c...vey.php?questionid=1

I don't know what is wrong because I'm an relatively new to php.

This is how I created the my fields.

Code: Text [Select]
  1. CREATE TABLE `answers` (
  2.   `AnswerID` int(11) NOT NULL auto_increment,
  3.   `AnswerValue` int(11) default '0',
  4.   `AnswerIP` text,
  5.   `QuestionID` int(11) default '0',
  6.   PRIMARY KEY  (`AnswerID`)
  7. ) TYPE=MyISAM;
  8.  
  9. CREATE TABLE `options` (
  10.   `OptionID` int(11) NOT NULL auto_increment,
  11.   `QuestionID` int(11) default '0',
  12.   `OptionText` text,
  13.   `OptionValue` int(11) default '0',
  14.   PRIMARY KEY  (`OptionID`)
  15. ) TYPE=MyISAM;
  16.  
  17. CREATE TABLE `questions` (
  18.   `QuestionID` int(11) NOT NULL auto_increment,
  19.   `QuestionText` text NOT NULL,
  20.   PRIMARY KEY  (`QuestionID`)
  21. ) TYPE=MyISAM;


Also, I added a record in 'questions' with id being 1, and text being 'What's your favorite color'.
and for options I connected each option to questionid=1.

I'm pretty sure my database is correct because everything makes sense and everything is spelled the same.

Please take a look and give me a few suggestions


9
Code: Javascript [Select]
  1. if(onclick() == true)
  2.     {
  3.       onmouseout() = null;
  4.     }


I was trying this code but I get an error "onClick not defined".
Any Ideas?

10
Developer's Corner / two way bubble sort
« on: September 07, 2008, 11:23 AM »
Code: Java [Select]
  1. public static void bubble( int a[] )
  2.   {
  3.     boolean done = false;
  4.     int temp;
  5.    
  6.     for( int forwardPass = 1; forwardPass < N && !done; forwardPass++ )
  7.     {
  8.       done = true;
  9.       for( int i = 0; i < N - forwardPass; i++ )
  10.       {
  11.         if( a[ i ] > a[ i + 1 ] )
  12.         {
  13.           temp = a[ i ];
  14.           a[ i ] = a[ i + 1 ];
  15.           a[ i + 1 ] = temp;
  16.          
  17.           if( a[ i ] < a[ i - 1 ] )
  18.             {
  19.               temp = a[ i ];
  20.               a[ i ] = a[ i - 1 ];
  21.               a[ i - 1 ] = temp;
  22.               done = false;
  23.             }      
  24.           done = false;
  25.         }
  26.       }
  27.     }
  28.   }

I'm trying to write a method that will sort some values that I've put into an array.

The first "if" statement does a bubble sort forwards and I know that works. I'm trying to get the bubble sort to sort backwards after the forward pass and the 2nd "if" statement is my attempt at doing so.

It seems to me that the code provided would work accordingly but it doesn't. I tried commenting out the first "if" statement and the program stops working at the 2nd "if" statement. However, if nothing is commented out then the program sorts like it should so maybe I'm testing it wrong.

11
Developer's Corner / C# Palindrom Recursive Program
« on: April 17, 2007, 09:38 PM »
I have to make a program using C# that makes a PalindromeTester using Recursive methods. I can make the program using normal methods i.e. while statements and nested if statements. I can't figure it out even after doing a lot of research and while looking at sudocode from someone writing it in java. Could someone help. I don't necessarily want someone to do the work for me but help me think it through using the c# language. I would talk to my Teacher about it but she can't bring herself to coming to my level. People with Ph.D's shouldn't be allowed to teach low level college classes. 

Pages: [1]