Solved

How can I test incoming fields to determine radio button values and check box true/false in C# .NET 2005

Posted on 2007-03-23
12
377 Views
Last Modified: 2013-12-17
I'm new to EE and I'm creating my first web page/app using C# .NET 2005. Can anyone help me figure out how I would go about testing the incoming data, being pulled from an oracle database so that I can set radio buttons and check boxes to determine which one should be checked for radio buttons or if the checkbox should or should not be checked. Again, I'm new to web and C#. This is my first web app and i'm having issues with it. The code below is my results page which will show multiple records in a repeater, data bound to my labels. I'm sure my code is ugly and sloppy but any help would be appreciated. Thanks in advance.

Jim

Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Results.aspx.cs" Inherits="Results" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript" language="javascript">

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Search Results</title>
</head>
<body bgcolor="#ccffff">
    <form id="form1" runat="server">
    <div>
        <asp:Panel ID="pResults" runat="server" BackColor="Black" BorderStyle="Outset" Height="48px"
            Width="1222px">
            <span style="font-size: 32pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ffff66">Search Results</span></span></asp:Panel>
        &nbsp;</div>
        <br />
        <div style="z-index: 101; left: 582px; width: 150px; position: absolute; top: 89px;
            height: 38px">
            <asp:Button ID="btnRefSearch" runat="server" Font-Bold="True" Font-Size="Larger"
                Height="28px" Text="Refine Search" Width="147px" PostBackUrl="~/Default.aspx" /></div>
        &nbsp;&nbsp;
       
        <asp:Repeater ID="rptrResults" runat="server" DataSourceID="dsDies" DataMember="DefaultView">
          <HeaderTemplate>
          <table>
          </HeaderTemplate>
            <Itemtemplate>
              <tr>
                <td><div style="z-index: 104; left: 10px; width: 1018px; position: absolute; top: 199px;
            height: 278px">
        <asp:Label ID="Label1" runat="server" Text="-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
            Width="1232px"></asp:Label><table id="rTable1">
                <tr>
                    <td style="width: 88px; height: 29px;">
                    <asp:Label ID="lblrDieNum" runat="server" Font-Bold="True" Font-Underline="True"
                        Height="22px" Text="Die # :" Width="47px"></asp:Label></td>
                    <td style="width: 100px; height: 29px;">
                    <asp:Label ID="lblrDsplyDieNum" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"DIE_NUM")%>'
                        Width="120px"></asp:Label></td>
                    <td style="width: 331px; height: 29px;">
                        <div style="z-index: 103; left: 247px; width: 301px; position: absolute; top: 22px;
                            height: 44px">
            <asp:RadioButtonList ID="rdorCreatedfor" runat="server" Height="11px" RepeatDirection="Horizontal"
                TabIndex="43"  Width="298px">
                <asp:ListItem>Brausse</asp:ListItem>
                <asp:ListItem>40&quot; Cyl</asp:ListItem>
                <asp:ListItem>32&quot; Cyl</asp:ListItem>
                <asp:ListItem>Kluge</asp:ListItem>
            </asp:RadioButtonList></div>
                    </td>
                    <td style="width: 153px; text-align: right; height: 29px;">
                    <asp:CheckBox ID="cbxrDiscarded" runat="server" Font-Bold="True" Text="Discarded"
                        Width="105px" /></td>
                </tr>
            </table>
        <div id="rLayerPic" style="z-index: 102; left: 816px; width: 239px; position: absolute;
            top: 26px; height: 159px">
            <asp:ImageButton ID="imgDie" runat="server" Height="143px" Width="243px" />
            <div style="z-index: 101; left: 0px; width: 246px; position: absolute; top: 159px;
                height: 26px" id="rLayerPicBtns">
                <asp:Button ID="btnrEnlarge" runat="server" Font-Bold="True" Text="Enlarge" Width="100px" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <asp:Button ID="btnrPrint" runat="server" Font-Bold="True" Text="Print" Width="100px" /></div>
        </div>
        <table id="rTable2">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrJobNum" runat="server" Font-Bold="True" Font-Underline="False"
                        Height="23px" Text="Job #'s"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ1" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"JOB_NUM")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ2" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ3" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ4" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 88px">
                    <asp:Label ID="lblrDsplyJ5" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ6" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 100px">
                    <asp:Label ID="lblrDsplyJ7" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable3">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrPockets" runat="server" Font-Bold="True" Text="Pockets"></asp:Label></td>
                <td style="width: 69px">
                    <asp:Label ID="lblrDsplyPkts" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"NUM_PKTS")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 106px; text-align: right">
                    <asp:Label ID="lblrFolded" runat="server" Font-Bold="True" Text="Folded"></asp:Label></td>
                <td style="width: 230px">
                    <asp:Label ID="lblrDsplyFldW" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLDED_WDTH")%>'
                        Width="58px"></asp:Label>
                    &nbsp;<asp:Label ID="lblrX1" runat="server" Font-Bold="True" Height="23px" Text="X"></asp:Label>&nbsp;
                    <asp:Label ID="lblrDsplyFldH" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLDED_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 34px; text-align: left">
                    <asp:Label ID="lblrFlat" runat="server" Font-Bold="True" Text="Flat" Width="30px"></asp:Label></td>
                <td style="width: 207px">
                    <asp:Label ID="lblrDsplyFlatW" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLAT_WDTH")%>'
                        Width="58px"></asp:Label>&nbsp;
                    <asp:Label ID="lblrX2" runat="server" Font-Bold="True" Height="23px" Text="X"></asp:Label>&nbsp;
                    <asp:Label ID="lblrDsplyFlatH" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLAT_HGHT")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table style="width: 774px; height: 19px" id="rTable4">
            <tr>
                <td style="width: 15px">
                    <asp:Label ID="lblrLPocket" runat="server" Font-Bold="True" Text="L Pocket" Width="64px"></asp:Label></td>
                <td style="width: 45px">
                    <asp:Label ID="lblrDsplyLPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"L_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 15px">
                    <asp:Label ID="lblRPocket" runat="server" Font-Bold="True" Text="R Pocket" Width="65px"></asp:Label></td>
                <td style="width: 60px">
                    <asp:Label ID="lblrDsplyRPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"R_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 58px">
                    <asp:Label ID="lblrCPocket" runat="server" Font-Bold="True" Text="C Pocket" Width="61px" Height="23px"></asp:Label></td>
                <td style="width: 55px">
                    <asp:Label ID="lblrDsplyCPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"CTR_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 61px">
                    <asp:Label ID="lblVPocket" runat="server" Font-Bold="True" Text="V Pocket" Height="23px"></asp:Label></td>
                <td style="width: 92px">
                    <asp:Label ID="lblrDsplyVPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"Vert_PKT_WDTH")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable5">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrBCSlits" runat="server" Font-Bold="True" Text="B.C. Slits" Width="65px"></asp:Label></td>
                <td style="width: 503px">
                    <asp:Label ID="lblrDsplyBC" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"BC_SLITS")%>'
                        Font-Bold="False" Width="426px"></asp:Label></td>
                <td style="width: 39px">
                    <asp:Label ID="lblrNumUp" runat="server" Font-Bold="True" Text="# Up" Width="38px"></asp:Label></td>
                <td style="width: 75px">
                    <asp:Label ID="lblrDsplyNumUp" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"UP")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable6">
            <tr>
                <td style="width: 87px; height: 29px;">
                    <asp:Label ID="lblrNotes" runat="server" Font-Bold="True" Text="Notes"></asp:Label></td>
                <td style="width: 100px; height: 29px;">
                    <asp:Label ID="lblrDsplyNotes" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"NOTE")%>'
                        Font-Bold="False" Width="427px"></asp:Label></td>
                <td style="width: 177px; text-align: right; height: 29px;">
                    <asp:Button ID="btnrEditInfo" runat="server" Font-Bold="True"
                        Text="Edit Info" Width="94px"/></td>
            </tr>
        </table>
        </div>
        <br /></td>
              </tr>
            </Itemtemplate>
            <FooterTemplate>
            </Table>
            </FooterTemplate>
        </asp:Repeater>
        <asp:SqlDataSource ID="dsDies" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT APP.DL_MAIN.DIE_NUM, APP.DL_MAIN.NUM_PKTS, APP.DL_MAIN.FLDED_WDTH, APP.DL_MAIN.FLDED_HGHT, APP.DL_MAIN.FLAT_WDTH, APP.DL_MAIN.FLAT_HGHT, APP.DL_MAIN.L_PKT_HGHT, APP.DL_MAIN.R_PKT_HGHT, APP.DL_MAIN.CTR_PKT_HGHT, APP.DL_MAIN.VERT_PKT_WDTH, APP.DL_MAIN.BC_SLITS, APP.DL_MAIN.NOTE, APP.DL_MAIN.UP, APP.DL_MAIN."TYPE", APP.DL_MAIN.THREE_PANEL_CB, APP.DL_MAIN.BOX_PKTS_CB, APP.DL_MAIN.CUSTOM_CB, APP.DL_MAIN.EXP_PKT_CB, APP.DL_MAIN.TAB_EXT_CB, APP.DL_MAIN.HOTEL_KC_CB, APP.DL_MAIN.LEGAL_SZ_CB, APP.DL_MAIN.REINFORCED_CB, APP.DL_MAIN.TOP_REINF_CB, APP.DL_MAIN.SM_MINI_CB, APP.DL_MAIN.STANDARD_CB, APP.DL_MAIN.VERT_PKT_CB, APP.DL_MAIN.BC_SLITS_CB, APP.DL_MAIN.BINDER_CB, APP.DL_MAIN.BOXES_CB, APP.DL_MAIN.MEDIA_BOX_CB, APP.DL_MAIN.SFTWR_BOX_CB, APP.DL_MAIN.TOTE_BOX_CB, APP.DL_MAIN.CD_DVD_CB, APP.DL_MAIN.CERT_HLDR_CB, APP.DL_MAIN.DIGITRAY_CB, APP.DL_MAIN.FL_FLDR_CB, APP.DL_MAIN.INDEX_TAB_CB, APP.DL_MAIN.PG_PKTS_CB, APP.DL_MAIN.PHOTO_HLDR_CB, APP.DL_MAIN.PORTFOLIO_CB, APP.DL_MAIN.RPRT_CVR_CB, APP.DL_MAIN.TANG_CVR_CB, APP.DL_MAIN.TAX_CVR_CB, APP.DL_MAIN.WLTS_DOCS_CB, APP.DL_MAIN.WINDOWS_CB, APP.DL_MAIN.SCR_PERF_CB, APP.DL_MAIN.DISCARDED_CB, APP.DL_MAIN.USERNAME, APP.DL_MAIN.IMG_FILE_NAME, APP.DL_JOB.DIE_NUM AS EXPR1, APP.DL_JOB.JOB_NUM, APP.DL_JOB.JOB_DATE FROM APP.DL_MAIN INNER JOIN APP.DL_JOB ON APP.DL_MAIN.DIE_NUM = APP.DL_JOB.DIE_NUM'>
        </asp:SqlDataSource>
        &nbsp;
    </form>
</body>
</html>

p.s - I do have a few other pages in this app. I have a search page that has check boxes and text fields that can be used to help search. The search page will use the selected/entered criteria to reach out to the database and grab records to display anything that is close to what they are looking for, about 10 records at a time in the results page, which is the page the code above is from.
0
Comment
Question by:jimmyb0004
  • 7
  • 5
12 Comments
 
LVL 1

Assisted Solution

by:aisp
aisp earned 500 total points
ID: 18782958
You need to handle these values in your server side event handlers. You might want to view the following webcast "Understanding More About Events and Postback"
http://www.asp.net/learn/videos/view.aspx?tabid=63&id=12

The design on your application can be improved. You might be interested to view other beginner level videos available at http://www.asp.net/learn/videos/default.aspx?tabid=63.

The site has a link to http://www.learn2asp.net/ that contains many other free webcasts.

0
 
LVL 1

Author Comment

by:jimmyb0004
ID: 18783390
Thanks, I appreciate the pointers and links. I was thinking about making it an windows app instead of a web bacause that's more what i'm used to doing. I've been working on this web app for about a month now.. not quite. It's almost finished. I just have to figure out how to test for the value and then set the radio buttons accordingly. Now it's more personal and I can't give up on this app, but i'm running out of time. If anyone has any other pointers please feel free to post. Any help will most definitely be appreciated. I'm going to go over those links thoroughly and i'll keep checking back for a few days.

Thanks again aisp for you post and the links. I appreciate it much. I'm sure i'll be speaking here again soon.
0
 
LVL 1

Assisted Solution

by:aisp
aisp earned 500 total points
ID: 18783807
Sorry for a not very pointed "pointer. To be more specific I meant two things:
1)
A simpler solution to dispaly search results would involve using GridView control. Out of the box you have paging trough results and editing in the grid. Or you can present results in the grid as read-only and provide links for items in the grid  that would bring detailed single record views. There is no problems in this approach with populating values in the detailed view if this view corresponds to a single record in the database.

2)
In your current approach using Repeater you can use an expression to detemine the value of Checked attribute based on the data from the database. Something like this:
 <asp:CheckBox ID="cbxrDiscarded" runat="server" Font-Bold="True" Text="Discarded"
   Checked='<%#DataBinder.Eval(Container.DataItem, "UDiscardedColumn") %>'    Width="105px" /></td>

You can use a similar approach for RadioButton control but in your example you have RadioButtonList which supports data biding directly. For this control just set databinding properties as for the rest of data-bindable fields.

I hope that 2) above answers your specific question but you may want to consider refactoring the application as in 1)
0
 
LVL 1

Author Comment

by:jimmyb0004
ID: 18809834
Sorry it took so long for me to get back to you. I'm still going over some of the info from the links you supplied as well as other links I've been finding. The #2 answer you posted is more of what i needed. In these links and a lot of the tutorials or webinars I've been looking at want you to use the Grid-View and forms view..etc..etc. The web app I'm working with is a design that the company had specifically requested as their front end for the users to use which would be simple enough for them to keep up the information with little confusion for them. Oracle doesn't hold a boolean value in there database so I'm trying to use 1 and 0 for checkbox values in the db fields. That, and the radio buttons are still kicking my butt. I'm still having trouble testing the incoming value to select the proper radio button value. I tried to do an if statement within the html source code but it didn't like it.
0
 
LVL 1

Assisted Solution

by:aisp
aisp earned 500 total points
ID: 18810032
You might want to post an updated version of what you are trying to do now. I'm pretty sure that with some minor tweaks the approach similar to #2 above should work both for checkboxes and for radio buttons. I would suggest to create a simplified test form with just a checkbox and a radio button to work out this technical hurdle. It will be easier then to post the exact code that corresponds to the test case.
0
 
LVL 1

Author Comment

by:jimmyb0004
ID: 18811677
I added values to my radio button list and I have all my controls set to runat="server" as you can see. From what I've noticed so far, It seems I may have to create a class DAL or object datasource and handle it that way. I'm not positive and hope I don't have to get to crazy with it all, but I'm thinking that's the only way to handle it. I'm still watching webinars and webcasts from the links you provided and they cover the basics, but I need something a little more advanced. I'm still going through them anyway just to make sure there's not an easier way to handle it. I haven't changed the code at all really except for what I did with the radio button list values and trying to move some things around but I'm trying to stick with my design and just bind. I posted the code below again and just need to figure out how I can test what's being pulled to set the selected to whichever radio button it corresponds too. The values in the DB are the same as the values in the radio button list. EX. DB_TABLE value for the radio button list can be either a B, K, C or J in the database. If the value is B when I call the record then I want to select the radio button in the list that has the value of B. My checkboxes are either a 1 or a 0 in the Oracle DB. If it's a 1 check= true, 0 then check = false. I just can't figure out how to do the test. I'm hoping maybe now that the values are set for the radio button list maybe that will help some how. I was thinking the same thing about creating a new simplified test form with radio button list and checkbox to test it all, as you mentioned. The code below is basically the same as before, I haven't made any real changes. Still trying to go over all the basics to make sure I have them down. So far it's mainly review of what I went through to get this far, but some are making more sense the second time around :-). I just need to find something that is more advanced or aimed to the specific design instead of their ready created objects like the gridview, detailsview and formview..etc.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Results.aspx.cs" Inherits="Results" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Search Results</title>    
</head>
<body bgcolor="#ccffff">
    <form id="form1" runat="server">
    <div>
        <asp:Panel ID="pResults" runat="server" BackColor="Black" BorderStyle="Outset" Height="48px"
            Width="1222px">
            <span style="font-size: 32pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ffff66">Search Results</span></span></asp:Panel>
        &nbsp;</div>
        <br />
        <div style="z-index: 101; left: 582px; width: 150px; position: absolute; top: 89px;
            height: 38px">
            <asp:Button ID="btnRefSearch" runat="server" Font-Bold="True" Font-Size="Larger"
                Height="28px" Text="Refine Search" Width="147px" PostBackUrl="~/Default.aspx" /></div>
        &nbsp;&nbsp;&nbsp;
       
        <asp:Repeater ID="rptrResults" runat="server" DataSourceID="dsDies" DataMember="DefaultView">
          <HeaderTemplate>
          <table>
          </HeaderTemplate>
            <Itemtemplate>
              <tr>
                <td><div style="z-index: 104; left: 10px; width: 1018px; position: absolute; top: 199px;
            height: 278px">
        <asp:Label ID="Label1" runat="server" Text="-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
            Width="1232px"></asp:Label><table id="rTable1">
                <tr>
                    <td style="width: 88px; height: 29px;">
                    <asp:Label ID="lblrDieNum" runat="server" Font-Bold="True" Font-Underline="True"
                        Height="22px" Text="Die # :" Width="47px"></asp:Label></td>
                    <td style="width: 100px; height: 29px;">
                    <asp:Label ID="lblrDsplyDieNum" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"DIE_NUM")%>'
                        Width="120px"></asp:Label></td>
                    <td style="width: 331px; height: 29px;">
                        <div style="z-index: 103; left: 247px; width: 301px; position: absolute; top: 22px;
                            height: 44px">
            <asp:RadioButtonList ID="rdorCreatedfor" runat="server" Height="11px" RepeatDirection="Horizontal"
                TabIndex="43"  Width="298px">
                <asp:ListItem Value="B">Brausse</asp:ListItem>
                <asp:ListItem Value="J">40&quot; Cyl</asp:ListItem>
                <asp:ListItem Value="C">32&quot; Cyl</asp:ListItem>
                <asp:ListItem Value="K">Kluge</asp:ListItem>
            </asp:RadioButtonList>
         
            </div>
                    </td>
                    <td style="width: 153px; text-align: right; height: 29px;">
                    <asp:CheckBox ID="cbxrDiscarded" runat="server" Font-Bold="True" Text="Discarded" Width="105px" /></td>
                </tr>
            </table>
        <div id="rLayerPic" style="z-index: 102; left: 816px; width: 239px; position: absolute;
            top: 26px; height: 159px">
            <asp:ImageButton ID="imgDie" runat="server" Height="143px" Width="243px" />
            <div style="z-index: 101; left: 0px; width: 246px; position: absolute; top: 159px;
                height: 26px" id="rLayerPicBtns">
                <asp:Button ID="btnrEnlarge" runat="server" Font-Bold="True" Text="Enlarge" Width="100px" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <asp:Button ID="btnrPrint" runat="server" Font-Bold="True" Text="Print" Width="100px" /></div>
        </div>
        <table id="rTable2">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrJobNum" runat="server" Font-Bold="True" Font-Underline="False"
                        Height="23px" Text="Job #'s"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ1" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"JOB_NUM")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ2" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ3" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ4" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 88px">
                    <asp:Label ID="lblrDsplyJ5" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ6" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 100px">
                    <asp:Label ID="lblrDsplyJ7" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable3">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrPockets" runat="server" Font-Bold="True" Text="Pockets"></asp:Label></td>
                <td style="width: 69px">
                    <asp:Label ID="lblrDsplyPkts" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"NUM_PKTS")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 106px; text-align: right">
                    <asp:Label ID="lblrFolded" runat="server" Font-Bold="True" Text="Folded"></asp:Label></td>
                <td style="width: 230px">
                    <asp:Label ID="lblrDsplyFldW" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLDED_WDTH")%>'
                        Width="58px"></asp:Label>
                    &nbsp;<asp:Label ID="lblrX1" runat="server" Font-Bold="True" Height="23px" Text="X"></asp:Label>&nbsp;
                    <asp:Label ID="lblrDsplyFldH" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLDED_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 34px; text-align: left">
                    <asp:Label ID="lblrFlat" runat="server" Font-Bold="True" Text="Flat" Width="30px"></asp:Label></td>
                <td style="width: 207px">
                    <asp:Label ID="lblrDsplyFlatW" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLAT_WDTH")%>'
                        Width="58px"></asp:Label>&nbsp;
                    <asp:Label ID="lblrX2" runat="server" Font-Bold="True" Height="23px" Text="X"></asp:Label>&nbsp;
                    <asp:Label ID="lblrDsplyFlatH" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLAT_HGHT")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table style="width: 774px; height: 19px" id="rTable4">
            <tr>
                <td style="width: 15px">
                    <asp:Label ID="lblrLPocket" runat="server" Font-Bold="True" Text="L Pocket" Width="64px"></asp:Label></td>
                <td style="width: 45px">
                    <asp:Label ID="lblrDsplyLPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"L_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 15px">
                    <asp:Label ID="lblRPocket" runat="server" Font-Bold="True" Text="R Pocket" Width="65px"></asp:Label></td>
                <td style="width: 60px">
                    <asp:Label ID="lblrDsplyRPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"R_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 58px">
                    <asp:Label ID="lblrCPocket" runat="server" Font-Bold="True" Text="C Pocket" Width="61px" Height="23px"></asp:Label></td>
                <td style="width: 55px">
                    <asp:Label ID="lblrDsplyCPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"CTR_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 61px">
                    <asp:Label ID="lblVPocket" runat="server" Font-Bold="True" Text="V Pocket" Height="23px"></asp:Label></td>
                <td style="width: 92px">
                    <asp:Label ID="lblrDsplyVPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"Vert_PKT_WDTH")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable5">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrBCSlits" runat="server" Font-Bold="True" Text="B.C. Slits" Width="65px"></asp:Label></td>
                <td style="width: 503px">
                    <asp:Label ID="lblrDsplyBC" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"BC_SLITS")%>'
                        Font-Bold="False" Width="426px"></asp:Label></td>
                <td style="width: 39px">
                    <asp:Label ID="lblrNumUp" runat="server" Font-Bold="True" Text="# Up" Width="38px"></asp:Label></td>
                <td style="width: 75px">
                    <asp:Label ID="lblrDsplyNumUp" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"UP")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable6">
            <tr>
                <td style="width: 87px; height: 29px;">
                    <asp:Label ID="lblrNotes" runat="server" Font-Bold="True" Text="Notes"></asp:Label></td>
                <td style="width: 100px; height: 29px;">
                    <asp:Label ID="lblrDsplyNotes" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"NOTE")%>'
                        Font-Bold="False" Width="427px"></asp:Label></td>
                <td style="width: 177px; text-align: right; height: 29px;">
                    <asp:Button ID="btnrEditInfo" runat="server" Font-Bold="True"
                        Text="Edit Info" Width="94px"/></td>
            </tr>
        </table>
        </div>
        <br /></td>
              </tr>
            </Itemtemplate>
            <FooterTemplate>
            </Table>
            </FooterTemplate>
        </asp:Repeater>
        <asp:SqlDataSource ID="dsDies" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT* FROM APP.DL_MAIN INNER JOIN APP.DL_JOB ON APP.DL_MAIN.DIE_NUM = APP.DL_JOB.DIE_NUM'>
        </asp:SqlDataSource>
        &nbsp; &nbsp;
    </form>
</body>
</html>
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:jimmyb0004
ID: 18811695
I added values to my radio button list and I have all my controls set to runat="server" as you can see. From what I've noticed so far, It seems I may have to create a class DAL or object datasource and handle it that way. I'm not positive and hope I don't have to get to crazy with it all, but I'm thinking that's the only way to handle it. I'm still watching webinars and webcasts from the links you provided and they cover the basics, but I need something a little more advanced. I'm still going through them anyway just to make sure there's not an easier way to handle it. I haven't changed the code at all really except for what I did with the radio button list values and trying to move some things around but I'm trying to stick with my design and just bind. I posted the code below again and just need to figure out how I can test what's being pulled to set the selected to whichever radio button it corresponds too. The values in the DB are the same as the values in the radio button list. EX. DB_TABLE value for the radio button list can be either a B, K, C or J in the database. If the value is B when I call the record then I want to select the radio button in the list that has the value of B. My checkboxes are either a 1 or a 0 in the Oracle DB. If it's a 1 check= true, 0 then check = false. I just can't figure out how to do the test. I'm hoping maybe now that the values are set for the radio button list maybe that will help some how. I was thinking the same thing about creating a new simplified test form with radio button list and checkbox to test it all, as you mentioned. The code below is basically the same as before, I haven't made any real changes. Still trying to go over all the basics to make sure I have them down. So far it's mainly review of what I went through to get this far, but some are making more sense the second time around :-). I just need to find something that is more advanced or aimed to the specific design instead of their ready created objects like the gridview, detailsview and formview..etc. Again, I'm sorry for the sloppy code and minimal web app experience. And again, I appreciate all the help and responses you're giving me it has been truly helpful so far.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Results.aspx.cs" Inherits="Results" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Search Results</title>    
</head>
<body bgcolor="#ccffff">
    <form id="form1" runat="server">
    <div>
        <asp:Panel ID="pResults" runat="server" BackColor="Black" BorderStyle="Outset" Height="48px"
            Width="1222px">
            <span style="font-size: 32pt">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ffff66">Search Results</span></span></asp:Panel>
        &nbsp;</div>
        <br />
        <div style="z-index: 101; left: 582px; width: 150px; position: absolute; top: 89px;
            height: 38px">
            <asp:Button ID="btnRefSearch" runat="server" Font-Bold="True" Font-Size="Larger"
                Height="28px" Text="Refine Search" Width="147px" PostBackUrl="~/Default.aspx" /></div>
        &nbsp;&nbsp;&nbsp;
       
        <asp:Repeater ID="rptrResults" runat="server" DataSourceID="dsDies" DataMember="DefaultView">
          <HeaderTemplate>
          <table>
          </HeaderTemplate>
            <Itemtemplate>
              <tr>
                <td><div style="z-index: 104; left: 10px; width: 1018px; position: absolute; top: 199px;
            height: 278px">
        <asp:Label ID="Label1" runat="server" Text="-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
            Width="1232px"></asp:Label><table id="rTable1">
                <tr>
                    <td style="width: 88px; height: 29px;">
                    <asp:Label ID="lblrDieNum" runat="server" Font-Bold="True" Font-Underline="True"
                        Height="22px" Text="Die # :" Width="47px"></asp:Label></td>
                    <td style="width: 100px; height: 29px;">
                    <asp:Label ID="lblrDsplyDieNum" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"DIE_NUM")%>'
                        Width="120px"></asp:Label></td>
                    <td style="width: 331px; height: 29px;">
                        <div style="z-index: 103; left: 247px; width: 301px; position: absolute; top: 22px;
                            height: 44px">
            <asp:RadioButtonList ID="rdorCreatedfor" runat="server" Height="11px" RepeatDirection="Horizontal"
                TabIndex="43"  Width="298px">
                <asp:ListItem Value="B">Brausse</asp:ListItem>
                <asp:ListItem Value="J">40&quot; Cyl</asp:ListItem>
                <asp:ListItem Value="C">32&quot; Cyl</asp:ListItem>
                <asp:ListItem Value="K">Kluge</asp:ListItem>
            </asp:RadioButtonList>
         
            </div>
                    </td>
                    <td style="width: 153px; text-align: right; height: 29px;">
                    <asp:CheckBox ID="cbxrDiscarded" runat="server" Font-Bold="True" Text="Discarded" Width="105px" /></td>
                </tr>
            </table>
        <div id="rLayerPic" style="z-index: 102; left: 816px; width: 239px; position: absolute;
            top: 26px; height: 159px">
            <asp:ImageButton ID="imgDie" runat="server" Height="143px" Width="243px" />
            <div style="z-index: 101; left: 0px; width: 246px; position: absolute; top: 159px;
                height: 26px" id="rLayerPicBtns">
                <asp:Button ID="btnrEnlarge" runat="server" Font-Bold="True" Text="Enlarge" Width="100px" />
                &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                <asp:Button ID="btnrPrint" runat="server" Font-Bold="True" Text="Print" Width="100px" /></div>
        </div>
        <table id="rTable2">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrJobNum" runat="server" Font-Bold="True" Font-Underline="False"
                        Height="23px" Text="Job #'s"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ1" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"JOB_NUM")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ2" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ3" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ4" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 88px">
                    <asp:Label ID="lblrDsplyJ5" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 87px">
                    <asp:Label ID="lblrDsplyJ6" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
                <td style="width: 100px">
                    <asp:Label ID="lblrDsplyJ7" runat="server" BackColor="AliceBlue" BorderStyle="Inset"
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable3">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrPockets" runat="server" Font-Bold="True" Text="Pockets"></asp:Label></td>
                <td style="width: 69px">
                    <asp:Label ID="lblrDsplyPkts" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"NUM_PKTS")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 106px; text-align: right">
                    <asp:Label ID="lblrFolded" runat="server" Font-Bold="True" Text="Folded"></asp:Label></td>
                <td style="width: 230px">
                    <asp:Label ID="lblrDsplyFldW" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLDED_WDTH")%>'
                        Width="58px"></asp:Label>
                    &nbsp;<asp:Label ID="lblrX1" runat="server" Font-Bold="True" Height="23px" Text="X"></asp:Label>&nbsp;
                    <asp:Label ID="lblrDsplyFldH" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLDED_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 34px; text-align: left">
                    <asp:Label ID="lblrFlat" runat="server" Font-Bold="True" Text="Flat" Width="30px"></asp:Label></td>
                <td style="width: 207px">
                    <asp:Label ID="lblrDsplyFlatW" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLAT_WDTH")%>'
                        Width="58px"></asp:Label>&nbsp;
                    <asp:Label ID="lblrX2" runat="server" Font-Bold="True" Height="23px" Text="X"></asp:Label>&nbsp;
                    <asp:Label ID="lblrDsplyFlatH" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"FLAT_HGHT")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table style="width: 774px; height: 19px" id="rTable4">
            <tr>
                <td style="width: 15px">
                    <asp:Label ID="lblrLPocket" runat="server" Font-Bold="True" Text="L Pocket" Width="64px"></asp:Label></td>
                <td style="width: 45px">
                    <asp:Label ID="lblrDsplyLPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"L_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 15px">
                    <asp:Label ID="lblRPocket" runat="server" Font-Bold="True" Text="R Pocket" Width="65px"></asp:Label></td>
                <td style="width: 60px">
                    <asp:Label ID="lblrDsplyRPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"R_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 58px">
                    <asp:Label ID="lblrCPocket" runat="server" Font-Bold="True" Text="C Pocket" Width="61px" Height="23px"></asp:Label></td>
                <td style="width: 55px">
                    <asp:Label ID="lblrDsplyCPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"CTR_PKT_HGHT")%>'
                        Width="58px"></asp:Label></td>
                <td style="width: 61px">
                    <asp:Label ID="lblVPocket" runat="server" Font-Bold="True" Text="V Pocket" Height="23px"></asp:Label></td>
                <td style="width: 92px">
                    <asp:Label ID="lblrDsplyVPkt" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"Vert_PKT_WDTH")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable5">
            <tr>
                <td style="width: 88px">
                    <asp:Label ID="lblrBCSlits" runat="server" Font-Bold="True" Text="B.C. Slits" Width="65px"></asp:Label></td>
                <td style="width: 503px">
                    <asp:Label ID="lblrDsplyBC" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"BC_SLITS")%>'
                        Font-Bold="False" Width="426px"></asp:Label></td>
                <td style="width: 39px">
                    <asp:Label ID="lblrNumUp" runat="server" Font-Bold="True" Text="# Up" Width="38px"></asp:Label></td>
                <td style="width: 75px">
                    <asp:Label ID="lblrDsplyNumUp" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"UP")%>'
                        Width="58px"></asp:Label></td>
            </tr>
        </table>
        <table id="rTable6">
            <tr>
                <td style="width: 87px; height: 29px;">
                    <asp:Label ID="lblrNotes" runat="server" Font-Bold="True" Text="Notes"></asp:Label></td>
                <td style="width: 100px; height: 29px;">
                    <asp:Label ID="lblrDsplyNotes" runat="server" BackColor="AliceBlue" BorderStyle="Inset" Text='<%#DataBinder.Eval(Container.DataItem,"NOTE")%>'
                        Font-Bold="False" Width="427px"></asp:Label></td>
                <td style="width: 177px; text-align: right; height: 29px;">
                    <asp:Button ID="btnrEditInfo" runat="server" Font-Bold="True"
                        Text="Edit Info" Width="94px"/></td>
            </tr>
        </table>
        </div>
        <br /></td>
              </tr>
            </Itemtemplate>
            <FooterTemplate>
            </Table>
            </FooterTemplate>
        </asp:Repeater>
        <asp:SqlDataSource ID="dsDies" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT* FROM APP.DL_MAIN INNER JOIN APP.DL_JOB ON APP.DL_MAIN.DIE_NUM = APP.DL_JOB.DIE_NUM'>
        </asp:SqlDataSource>
        &nbsp; &nbsp;
    </form>
</body>
</html>
0
 
LVL 1

Author Comment

by:jimmyb0004
ID: 18812093
Sorry about the double post above. I didn't think the first one went through and I wanted to make sure I added the thank you at the bottom of my statement for all your help. *shurgs*
0
 
LVL 1

Accepted Solution

by:
aisp earned 500 total points
ID: 18812560
Consider modifying your select statement to return boolean values that can be bound to checkbox and listitem controls

I do not know your field names so here is a query that returns an integer CheckValue and a string RadioValue
select 1 as CheckValue, 'B' as RadioValue from dual

You can use Oracle DECODE function, for example,
select DECODE(CheckValue, 1, 'true', 'false') as BoolCheckValue,
DECODE(RadioValue, 'B', 'true', 'false') as RadioValueB,
DECODE(RadioValue, 'K', 'true', 'false') as RadioValueK,
DECODE(RadioValue, 'C', 'true', 'false') as RadioValueC,
DECODE(RadioValue, 'J', 'true', 'false') as RadioValueJ
from (
select 1 as CheckValue, 'B' as RadioValue from dual
)
to  return BoolCheckValue, RadioValueB, RadioValueK, RadioValueC, and RadioValueJ that have true or false values.

You can modify your database query so that it returns decoded values as in the above (you can even keep the same names for the decoded fields) . Change you code then as follows
<asp:CheckBox ID="cbxrDiscarded" runat="server" Font-Bold="True" Text="Discarded"
Checked='<%#DataBinder.Eval(Container.DataItem, "BoolCheckValue") %>'    Width="105px" />

 <asp:RadioButtonList ID="rdorCreatedfor" runat="server" Height="11px" RepeatDirection="Horizontal"
TabIndex="43"  Width="298px">
<asp:ListItem Value="B"  Selected='<%#DataBinder.Eval(Container.DataItem, "RadioValueB") %>'   >Brausse</asp:ListItem>
<asp:ListItem Value="J"  Selected='<%#DataBinder.Eval(Container.DataItem, "RadioValueJ") %>'   >40&quot; Cyl</asp:ListItem>
<asp:ListItem Value="C"  Selected='<%#DataBinder.Eval(Container.DataItem, "RadioValueC") %>'   >32&quot; Cyl</asp:ListItem>
<asp:ListItem Value="K"  Selected='<%#DataBinder.Eval(Container.DataItem, "RadioValueK") %>'   >Kluge</asp:ListItem>
</asp:RadioButtonList>

This should do the trick with populating checkbox and radiobutton controls with values from the database

 

 
0
 
LVL 1

Author Comment

by:jimmyb0004
ID: 18818446
I got the statement itself to work fine. However, I get an error:

Error      1      Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.ListItem does not have a DataBinding event.      C:\Documents and Settings\jimburdick\Local Settings\Temp\VWDWebCache\www.independentinc.com_dielist\rdoTest.aspx      14      

I'm gonna continue to look into it myself as well, but that seems like it should work just fine. I created a new page with just the radio button list on it.. Here's the code for the new test page. Maybe I have something wrong. I left out the:

from (select 1 as CheckValue, 'B' as RadioValue from dual)

since I didn't have a checkbox on the page as of yet and didn't quite understand what that line was doing. I got the statement to work fine and it pulls the info from the database. The only issue seems to be the binding. Here's the code from the test page below.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="rdoTest.aspx.cs" Inherits="rdoTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RadioButtonList ID="RadioButtonList1" runat="server" DataSourceID="SqlDataSource1"
            DataTextField="RADIOVALUEB" DataValueField="RADIOVALUEB">
            <asp:ListItem Value="B" Selected='<%#DataBinder.Eval(Container.DataItem, "RadioValueB") %>'>Brausse</asp:ListItem>
            <asp:ListItem Value="K" Selected='<%#DataBinder.Eval(Container.DataItem, "RadioValueK") %>'>Kluge</asp:ListItem>
            <asp:ListItem Value="C" Selected='<%#DataBinder.Eval(Container.DataItem, "RadioValueC") %>'>32&quot;</asp:ListItem>
            <asp:ListItem Value="J" Selected='<%#DataBinder.Eval(Container.DataItem, "RadioValueJ") %>'>40&quot;</asp:ListItem>
        </asp:RadioButtonList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="Select DECODE(TYPE, 'B', 'true', 'false') as RadioValueB,DECODE(TYPE, 'K', 'true', 'false') as RadioValueK,DECODE(TYPE, 'C', 'true', 'false') as RadioValueC,DECODE(TYPE, 'J', 'true', 'false') as RadioValueJ FROM DL_MAIN">
        </asp:SqlDataSource>
   
    </div>
    </form>
</body>
</html>

What you posted seems to be the answer so far though, I'm just not sure why it won't bind, other than the explanation of course, that it doesn't have a databinding event. I'm looking into creating an event for the binding or something.
0
 
LVL 1

Assisted Solution

by:aisp
aisp earned 500 total points
ID: 18818729
try '<%#Eval("RadioValueK") %> etc. instead

see also this example
<%@ Page Language="C#" %>

<%@ Import Namespace="System.Data" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //Create a table structure
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("ItemID", System.Type.GetType("System.Int32")));
            dt.Columns.Add(new DataColumn("ItemDescription", System.Type.GetType("System.String")));
            dt.Columns.Add(new DataColumn("Flag", System.Type.GetType("System.Boolean")));

            //Add some data
            dt.Rows.Add(1, "apple", false);
            dt.Rows.Add(2, "carrot", true);
            dt.Rows.Add(3, "peach", false);

            //Bind to GridView
            GridView1.DataSource = dt;
            GridView1.DataBind();

            //Bind to Repeater
            Repeater1.DataSource = dt;
            Repeater1.DataBind();
        }
    }

    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox chk = (CheckBox)sender;
        MessageLabel.Text = "ItemID: " + chk.Text + " Checked: " + chk.Checked.ToString();
        //Insert Code to update the underlying data (field Flag in this case)
    }

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Checkbox Command Sample</title>
    <meta name="Description" content="" />
    <style type="text/css">
        .HiddenText label {display:none;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:Label ID="MessageLabel" runat="server" EnableViewState="false"></asp:Label>
        <h2>
            GridView Example</h2>
        <asp:GridView ID="GridView1" runat="server">
            <Columns>
                <asp:TemplateField>
                    <HeaderTemplate>
                        Flag
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="CheckBox1" Checked='<%#Eval("Flag")%>' Text='<%#Eval("ItemID")%>'
                            CssClass="HiddenText" AutoPostBack="true" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="ItemDescription" HeaderText="ItemDescription" />
            </Columns>
        </asp:GridView>
        <h2>
            Repeater Example</h2>
        <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <asp:CheckBox ID="CheckBox1" Checked='<%#Eval("Flag")%>' Text='<%#Eval("ItemID")%>'
                    CssClass="HiddenText" AutoPostBack="true" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" />
                <%#Eval("ItemDescription")%>
                <br />
            </ItemTemplate>
        </asp:Repeater>
    </form>
</body>
</html>
0
 
LVL 1

Author Comment

by:jimmyb0004
ID: 18825387
Woo Hoo! I got it to data bind finally. There was a few changes I had to make to what you posted, but I couldn't have done it without ya. I appreciate the help more than I can tell ya. Now I'm on to new issues, such as my repeater isn't repeating, just displaying the last record, but that's another question post. This issue is resolved and I couldn't have done it without your help aisp. Here is the code from my test page incase anyone else needs to look up this similar issue later. First thing I did was get rid of the radio button list. Databinding can't be done to list items it kept telling me so I changed to just radio buttons instead of list. The second thing I had to do was deal with radiovalueB vars that we created. The True/False strings in the Select DECODE(RadioValue, 'B', 'true', 'false') as RadioValueB, DECODE(RadioValue, 'K', 'true', 'false') as RadioValueK...etc..etc.. works really well, IF you change the true and false sections to this....

DECODE(RadioValue, 'B', 'checked', '') as RadioValueB

checked and empty string work but true and false didn't do it. Now the databinding is working to the individual radio buttons. Again, radio button list was causing issues with the error I posted before; "cannot bind to list item...".

The code below is the code from my Test page which works for databinding to the radio buttons;

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="rdoTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">


</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=dvlp;Persist Security Info=True;User ID=mattmx;Password=lancoves;Unicode=True"
            ProviderName="System.Data.OracleClient" SelectCommand="Select DECODE(TYPE, 'B', 'checked', '') as RadioValueB,DECODE(TYPE, 'K', 'checked', '') as RadioValueK,DECODE(TYPE, 'C', 'checked', '') as RadioValueC,DECODE(TYPE, 'J', 'checked', '') as RadioValueJ FROM DL_MAIN">
        </asp:SqlDataSource>    
        <asp:Repeater ID="Repeater1" runat="server" >
        <HeaderTemplate>
        </HeaderTemplate>
        <ItemTemplate>
        <input TYPE="radio" NAME="Type" VALUE="B" <%#DataBinder.Eval(Container.DataItem, "RadioValueB") %> />Brausse
        <input TYPE="radio" NAME="Type" VALUE="K" <%#DataBinder.Eval(Container.DataItem, "RadioValueK") %> />Kluge
        <input TYPE="radio" NAME="Type" VALUE="C" <%#DataBinder.Eval(Container.DataItem, "RadioValueC") %> />32"
        <input TYPE="radio" NAME="Type" VALUE="J" <%#DataBinder.Eval(Container.DataItem, "RadioValueJ") %> />40"
        </ItemTemplate>
        </asp:Repeater>
        </div>
    </form>
</body>
</html>

..........
DECODE(DATABASE.FIELDNAME.HERE, 'value.checking.for.here', 'checked', '') as VARIABLE.HERE

Thanks again aisp for pointing me in the right direction. It was a huge help in figuring out how to get it to bind..etc.. Hope this little piece i'm posting here helps someone else as well. I'm sure i'll be posting again soon. :-)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now