eallen
Posts: 25
|
Posted: 02/12/2004, 12:22 PM |
|
CCS newbie, using ASP and MSSQL. I have a grid with a link in the first column that when clicked it selects the grid row and display related child records in a dependent grid. I want to replace the link with a radio button that shows as selected and functions just like the link to select the grid row and display dependent grid child records.
Can someone point me to an example or give IDE steps to create.
Thank in advance
|
|
|
peterr
Posts: 5971
|
Posted: 02/12/2004, 2:40 PM |
|
Hmm, I responded to the same (or similar?) question from yourself, at: http://forums.codecharge.com/posts.php?post_id=42500
I described there how to change a link into a radio button.
Do you have additional questions?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
eallen
Posts: 25
|
Posted: 02/12/2004, 3:15 PM |
|
Peter, I have come a long ways with CCS since that post. Though I have used the part of the question regarding passing parameter, I have never been able to implement the code for the Radio button. In fact, I had forgetten about that part of the post.
In the situation where I want to use the radio button, I have 2 parameters to pass to a dependent grid found on the same page. Sample code of how to pass 2 parameters would be helpful.
TIA
|
|
|
peterr
Posts: 5971
|
Posted: 02/12/2004, 3:55 PM |
|
I believe that the Radio button doesn't support passing 2 values - this would be in conflict with HTML standards. That's why Links are commonly used to pass multiple parameters. However, you can work around it by adding a hidden field next to the Radio button, using similar code to the previous one. Just add "hidden" input to it.
Here is the working, tested code example, which can be used in the same way as described previously:
employees_grid.emp_name.Value = "<form method=""POST"" action=""MasterDetail.asp"">" & _
"<input type=""radio"" value=""" & employees_grid.emp_id.Value & """ name=""emp_id"" onclick=""this.form.submit();"">" & _
"<input type=""hidden"" value=""" & employees_grid.emp_name.Value & """ name=""emp_name"">" & _
employees_grid.emp_name.Value & "</form>"
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
eallen
Posts: 25
|
Posted: 02/12/2004, 4:33 PM |
|
I went back to the MasterDetail pages from the example pack and put in your code. After running the results, I remember that I had actually tested this before. One of the problems I saw with the example was the grid row heigth doubled, the radio button didn't stay selected after the refresh and the grid returned the first page. Not exactly what I wanted and my page is very similar in construction to that MasterDetail page.
So, I decide to try your code on another page that has dependent grids on the same page and requires only one parameter. The radio button doesn't show up in the column in the grid nor does the column data. I am trying to debug that now.
Here is the code. Clients.CliID is the db column that was the link, Primary key and related as the foriegn key in the dependent list. The Label name is: CliID.
Clients.CliID.Value = "<form method=""POST"" action=""Clients_List.asp""><input type=""radio"" value=""" & Clients.CliID.Value & """ name=""CliID"" onclick=""this.form.submit();"">" & Clients.CliID.Value & "</form>"
TIA for any suggestion on why the radio button doesn't show up.
|
|
|
peterr
Posts: 5971
|
Posted: 02/12/2004, 5:02 PM |
|
Hi,
The example given was just an example to put you on the right track. However, there are probably several other ways to do this. For example I just tried embedding the whole Grid into the <form> tag (in HTML) and then the custom code can be simpler, while you will see the Grid without the extra spacing:
employees_grid.emp_name.Value = "<input type=""radio"" value=""" & employees_grid.emp_id.Value & """ name=""emp_id"" onclick=""this.form.submit();"">" & employees_grid.emp_name.Value
The point is that if you know what HTML you want to output then you can do this via events. However, you may need to understand how HTML forms and Radio buttons work to take full advantage of them.
Looking at your code above I don't see any problems in it, but it's difficult to debug something without being able to test it. Sorry.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
peterr
Posts: 5971
|
Posted: 02/12/2004, 5:05 PM |
|
BTW, maybe add a line of code that will display the value of Clients.CliID, to make sure that it is not empty. For example
response.write Clients.CliID.Value & ":<br>"
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
eallen
Posts: 25
|
Posted: 02/12/2004, 5:08 PM |
|
Peter, I tried again with your suggestion of the hidden field and the code you suggest in my first test. I am still not getting a radio button showing in the grid. I have double checked to be sure the content is set to HTML. I have also changed the default name CCS gave to the grid and added _grid to be sure there was no confusion with the table name.
I'm Still not getting a radio button to show in the column on the test on the Clients page that uses 1 parameter or the Alerts
Here is the HTML code for this cell if that could have anything to do with it:
<td class="CobaltDataTD">{AlrID}<input type="hidden" value="{ALRPre}" name="{ALRPre_Name}" style="WIDTH: 58px; HEIGHT: 22px" size="7"></td>
TIA
|
|
|
eallen
Posts: 25
|
Posted: 02/12/2004, 5:20 PM |
|
> it's difficult to debug something without being able to test it. Sorry.
I know, but your help and suggestions are greatly appreciated.
The display of the Client.CliID shows that there are values there.
I have looked again at what/how the Example is working and I can't see any reason for the difference either.
Well, so much for the radio buttons for now.
Any quick example of how to change the background color of the row in a grid when I select my link (that was going to be a radio) to show the active row in the grid? This is going to be my next 'thng to learn' in CCS.
TIA
|
|
|
peterr
Posts: 5971
|
Posted: 02/12/2004, 5:44 PM |
|
The HTML code should be just a Label: {Label}
Changing the row colors should be done using any method that works without CCS. I'm assuming that some HTML and JavaScript should do: http://www.google.com/search?q=javascript+row+background+color
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|