topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Thursday November 26, 2020, 6:44 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.


Messages - 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
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

6
What is count(1)?
I am using SQL server and my table is as follows:

Table AppointmentName: AppID, LastName, FirstName, Email, BirthDate, Slot.

Slot gets an SelectedIndexValue from the radio button on submitClick.

On Page_Load is where I need to have the SQL statement to see how many times the value from the column "Slot" has been used.

7
You have to make a radiobuttonlist as follows

Code: HTML [Select]
  1. <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"
  2.                    RepeatColumns="3" TextAlign="Left">
  3.                     <asp:ListItem Value="1">07:00AM-07:15AM</asp:ListItem>
  4.                     <asp:ListItem Value="2">07:15AM-07:30AM</asp:ListItem>
  5.                     <asp:ListItem Value="3">07:30AM-07:45AM</asp:ListItem>
  6.                     <asp:ListItem Value="4">07:45AM-08:00AM</asp:ListItem>
  7.                 </asp:RadioButtonList>

Then add some statements to make sure its working (inside submitButton_Click). radioButton is my label
Code: C# [Select]
  1. if (RadioButtonList1.SelectedIndex > -1)
  2.         {
  3.             radioButton.Text = "<br />you selected: " + RadioButtonList1.SelectedIndex.ToString();
  4.         }
  5.         else
  6.         {
  7.             radioButton.Text = "Select a radio button";
  8.         }

Then attache it to the database like so:
Code: C# [Select]
  1. appNameComm = new SqlCommand("INSERT INTO AppointmentName (LastName, FirstName, Email, BirthDate, Slot) " +
  2.                 "VALUES (@LastName, @FirstName, @Email, @BirthDate, @Slot)", conn);
  3. .
  4. .
  5. .
  6. appNameComm.Parameters.Add("@Slot", System.Data.SqlDbType.Int, 2);
  7.             appNameComm.Parameters["@Slot"].Value = RadioButtonList1.SelectedIndex.ToString();

8
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.

9
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.

10
ASP.NET / Re: Simple form using visual web developer
« on: July 29, 2009, 03:44 PM »
I actually went with the ASP.NET book from sitepoint.com and have been able to complete most of my webform from that book. I would Highly recommend it to anyone starting out with visual web developer and ASP.NET.

However, I've come to another standstill. 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.

11
ASP.NET / Re: Simple form using visual web developer
« on: July 24, 2009, 03:37 PM »
Well in college I learned how to make databases in Access and I learned how to make webpages using HTML and script. however, I never got any classes putting them together. So, I'm sort of in the dark.

I'm going to be looking as well, but if you find something really pertinate to what i'm doing, please pot the URL.

12
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.

13
Developer's Corner / Re: multi answer multi choice database
« on: March 26, 2009, 07:52 AM »
I just don't know how to set it up in the database.

I have a table for the questions, possible answers, and the responses.

Will the response table take two answers?

14
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?

15
Oh wow! I had no idea it was case sensitive and to think I spent hours looking at it before I posted the problem here.

Thanks a lot justice. When I graduate college I'm definitely going to pass the buck (literal) because everyone here always helps and with a timely manner.

16
Developer's Corner / Re: Free Hosting that allows Javascript?
« on: March 08, 2009, 10:16 PM »
000webhost.com

they've got a nice set up and a good deal.

17
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


18
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?

19
Developer's Corner / Re: two way bubble sort
« on: September 07, 2008, 12:57 PM »
Code: C# [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.           done = false;
  17.         }
  18.       }
  19.     }
  20.   }

Please don't give me the answer but help walk me through it.

This is the code that makes the bubble sort keep making forward passes though the array until done = true (all the values in the array are sorted in a lowest to highest value order).
I am confused to hell as to how to make the sort make a forward pass and at the end make a backward pass and then forward again until all the values are in order.
Basically I'm trying to come up with the best algorithm of sorting to sort in the least amount of time using a bubble sort method (the one list above).

20
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.

21
Developer's Corner / Re: C# Palindrom Recursive Program
« on: April 19, 2007, 03:43 PM »
This is the Palindrom in non recursive format but I need to put it in recursive format. From my understanding I should put most of this code in a method, probably in another class, then have the main method call upon it every time the system loops
==========================================================
Code: C# [Select]
  1. namespace RecursivePalindromeTester
  2. {
  3.     class Palindrome
  4.     {
  5.         String str, another = "y";
  6.             int left, right;
  7.  
  8.             while (another.ToUpper() == "Y")
  9.             {
  10.                 Console.Out.WriteLine("Enter a potential Palindrome:");
  11.                 str = Console.In.ReadLine();
  12.  
  13.                 left = 0;
  14.                 right = str.Length - 1;
  15.  
  16.                 while (str[left] == str[right] && left < right)
  17.                 {
  18.                     left++;
  19.                     right--;
  20.                 }
  21.  
  22.                 Console.Out.WriteLine();
  23.  
  24.                 if (left < right)
  25.                     Console.Out.WriteLine("String is Not a Palindrome.");
  26.                 else
  27.                     Console.Out.WriteLine("String is a Palindrome.");
  28.                
  29.                 Console.Out.WriteLine();
  30.                 Console.Out.Write("Test another PalindromTester (Y/N)? ");
  31.                 another = Console.In.ReadLine();      
  32.     }
  33. }

22
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]