Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radiobuttonlist - get value from SQL DB

Status
Not open for further replies.

tsp1lrk72

IS-IT--Management
Feb 25, 2008
100
US
I have this code:

Code:
If Not Page.IsPostBack Then
            'Define connection to read the data
            Dim myConn As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
            Dim MyCmd As New SqlCommand("SELECT [VendorID],[DivisionName],[DeptName],[VendorName],[VendorCode],
[CurrentStatus],[Joined],[SKU],[EDI],[RBT],[ContactName],[ContactPhone],
[ContactFax],[EmailAddress]FROM [ENAPTEST].[dbo].[tblVendorInfo] Where VendorID =  @VendorID", myConn)
            MyCmd.CommandType = CommandType.Text
            MyCmd.Parameters.Add(New SqlParameter("@VendorID", SqlDbType.Int, 4)).Value = Convert.ToString(VendorID)
            myConn.Open()
            'Read the data
            Dim Result As SqlDataReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
            Result.Read()
            VendorNumber.Text = Result("VendorID").ToString()

            If Not Result.IsDBNull(0) Then
                DivisionName.Text = Result("DivisionName").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                DeptName.Text = Result("DeptName").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                VendorName.Text = Result("VendorName").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                VendorCode.Text = Result("VendorCode").ToString()
            End If
            
            If Not Result.IsDBNull(0) Then
                Joined.Text = Result("Joined").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                SKU.Text = Result("SKU").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                EDI.Text = Result("EDI").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                RBT.Text = Result("RBT").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                ContactName.Text = Result("ContactName").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                ContactPhone.Text = Result("ContactPhone").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                ContactFax.Text = Result("ContactFax").ToString()
            End If
            If Not Result.IsDBNull(0) Then
                EmailAddress.Text = Result("EmailAddress").ToString()
            End If

for my Datareader

Then I have:

Code:
Dim radList As RadioButtonList
            radList = CType(FindControl("CurrentStatus"), RadioButtonList)
            Do While Result.Read()
                Dim CurrentSelect As ListItem
                CurrentSelect = radList.Items.FindByValue(Result("CurrentStatus").ToString())
                If Not CurrentSelect Is Nothing Then
                    CurrentSelect.Selected = True
                End If
            Loop

for my radiobutton- I'm trying to get a value from the database and populate the radiobuttonlist with it to show what the user previously selected-- Any ideas????
It's not working...

Thanks...
 
Need to know a few things first. This radiobuttonlist is in a another control? Did you bind the radiobuttonlist or add listitems manually?
 
Code:
<asp:radiobuttonlist id="CurrentStatus" runat="server" Width="96px" CssClass="tb8" AutoPostBack="True">
											<asp:ListItem Value="100">Completed</asp:ListItem>
											<asp:ListItem Value="200">In Progress</asp:ListItem>
											<asp:ListItem Value="300">Problem</asp:ListItem>
										</asp:radiobuttonlist>

I manually added them to the control. When they edit their info I want them to see what they previously chose, that value is stored in a db table with a number value- so if the value is 200, have the "In progress" radio button selected when they go to edit their data- I'm using a datareader...

The radiobuttonlist is not in another control...
 
If it is not contained in another control, then I am confused as to why you are looping and using findcontrol. Can you post the HTML markup, that might clear up my confusion.
 
oh, you mean the findcontrol is only if I'm using like a datagrid or whatever right? Then no, it's just a regular web page with textboxes that I'm loading from a db, the values from those load just fine, I just can't get the radiobuttonlist to load the value from the db--

Sorry the confusion, thus my post on how to do this the right way! The above code is from the HTML...
 
Yes, you only need to use the findcontrol method when you have controls embedded within other controls.

Also I am assuming you are only expecting to get one row back from your query correct?

Then you can try something like this:
Code:
CurrentStatus.Items.FindByValue(Result("CurrentStatus").ToString())
 
Sorry:
Code:
CurrentStatus.Items.FindByValue(Result("CurrentStatus").ToString().Selected = True)
 
I get Selected is not a member of string... Ugh!!!
 
I changed it to:

Code:
CurrentStatus.Items.FindByValue(Result("CurrentStatus").Selected = True)

and got:
Public member 'Selected' on type 'String' not found.
 
Code:
CurrentStatus.Items.FindByValue(Result("CurrentStatus").ToString).Selected = True
 
I get:
Error: Object reference not set to an instance of an object.

What the heck??? This seems like such an easy thing to do yet nothing we try works! All I want is to make the radio button selected on that value when the user goes to edit their data!!

I also made sure that Result(CurrentStatus) is working and it is, I wrote it out to a label and saw that the value is 300 which is equivalent to "Problem" so why won't the radio button show on that selection?? UGH!!!
 
Show us two things:

1. What "Result("CurrentStatus").ToString" equals when you put a breakpoint on that line
2. The resulting HTML that the browser sees


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
To answer your questions:
1. What "Result("CurrentStatus").ToString" equals when you put a breakpoint on that line

This equals 300

2. The resulting HTML that the browser sees
This the radiobuttonlist before:
Code:
<asp:radiobuttonlist id="CurrentStatus" runat="server" Width="96px" AutoPostBack="True">
												<asp:ListItem text= "100" Value="100">Completed</asp:ListItem>
												<asp:ListItem text= "200" Value="200">In Progress</asp:ListItem>
												<asp:ListItem text = "300" Value="300">Problem</asp:ListItem>
											</asp:radiobuttonlist>

After:
Code:
<TR>
													<TD style="WIDTH: 206px; HEIGHT: 22px" bgColor="#ffffcc">Status:</TD>
													<TD style="HEIGHT: 22px" bgColor="#ffffcc">
														<span id="CurrentStatus">Problem</span></TD>
												</TR>

When I hardcode the value:

Code:
CurrentStatus.Items.FindByValue("300").Selected = True

it works... for some reason, it's not liking the Result(CurrentStatus) line...although when I write it to a label, it reads it...
 
Code:
<TR>
                                                    <TD style="WIDTH: 206px; HEIGHT: 22px" bgColor="#ffffcc">Status:</TD>
                                                    <TD style="HEIGHT: 22px" bgColor="#ffffcc">
                                                        <span id="CurrentStatus">Problem</span></TD>
                                                </TR>
That can't be correct. A RadioButtonList will produce a list of option elements.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Before or after it processes? Before anything is changed it looks like this:

Code:
<asp:radiobuttonlist id="CurrentStatus" runat="server" Width="96px" AutoPostBack="True">
                                                <asp:ListItem text= "100" Value="100">Completed</asp:ListItem>
                                                <asp:ListItem text= "200" Value="200">In Progress</asp:ListItem>
                                                <asp:ListItem text = "300" Value="300">Problem</asp:ListItem>
                                            </asp:radiobuttonlist>

after I ran the hardcoded line with "300" in it:
Code:
CurrentStatus.Items.FindByValue("300").Selected = True

I got:
Code:
<TR>
                                                    <TD style="WIDTH: 206px; HEIGHT: 22px" bgColor="#ffffcc">Status:</TD>
                                                    <TD style="HEIGHT: 22px" bgColor="#ffffcc">
                                                        <span id="CurrentStatus">Problem</span></TD>
                                                </TR>

Anyway... it works with the hardcoded value, not the Result(currentStatus) value...





 
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>Edit Project Information</title>
		<meta content="False" name="vs_showGrid">
		<LINK href="[URL unfurl="true"]http://localhost/SKUPM/public/web.css"[/URL] type="text/css" rel="stylesheet">
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5"[/URL] name="vs_targetSchema">
	</HEAD>
	<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
		<IFRAME ID=__hifSmartNav NAME=__hifSmartNav STYLE=display:none src="/aspnet_client/system_web/1_1_4322/SmartNav.htm"></IFRAME>
<form name="Form1" method="post" action="EditInfo.aspx?VendorID=1" language="javascript" onsubmit="if (!ValidatorOnSubmit()) return false;" id="Form1" __smartNavEnabled="true">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="dDwtMTkwODQyMjYzNjt0PDtsPGk8MT47Pj...1BKlbAWYxJghAY=" />


<script language="JavaScript">
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
  return (new Object());
}

window.open = SymWinOpen;

//-->
</script>

<script language="javascript" type="text/javascript">
<!--
	function __doPostBack(eventTarget, eventArgument) {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
			theform = document.Form1;
		}
		else {
			theform = document.forms["Form1"];
		}
		theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
		theform.__EVENTARGUMENT.value = eventArgument;
		theform.submit();
	}
// -->
</script>

<script language="javascript" type="text/javascript" src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>

	
<script language="JScript" type="text/JScript" src="/aspnet_client/system_web/1_1_4322/SmartNav.js"></script>


			<TABLE id="Table1" style="HEIGHT: 75px" cellSpacing="0" cellPadding="3" width="100%" border="0">
				<TR>
					<TD colSpan="3">
<LINK rel="stylesheet" type="text/css" href="[URL unfurl="true"]http://localhost/SKUPM/public/web.css">[/URL]
<meta name="vs_showGrid" content="True">
<TABLE id="Table1" cellSpacing="0" cellPadding="0" border="0" width="100%">
	<TR>
		<TD style="WIDTH: 635px; HEIGHT: 103px" class="tb8" vAlign="top" colSpan="2" bgColor="#330000"><FONT>&nbsp;&nbsp;
				<BR>
			</FONT>
		</TD>
	</TR>
	<TR>
		<TD class="tb8" style="WIDTH: 635px; HEIGHT: 38px" bgColor="#ffffcc">
			<P class="hb10">&nbsp;
				<a id="Header1_lnkPassword" class="tn8" href="ChngPassword.aspx">Change Password</a>&nbsp;
				<a id="Header1_lnkVendorInfo" class="tn8" href="ViewVendorInfo.aspx"> View Vendor Info</a>&nbsp;&nbsp;
				<a id="Header1_lnkAddVendor" class="tn8" href="AddVendor.aspx">Add Vendor</a>&nbsp;&nbsp;&nbsp;
				<a id="Header1_lnkAddAccount" class="tn8" href="AddAccount.aspx">Add Account</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
				&nbsp;
				<span id="Header1_msgWelcome" class="tb8">Hello, Your Login ID is: lisa</span></P>
		</TD>
		<TD bgColor="#ffffcc" style="HEIGHT: 38px">
			<input type="submit" name="Header1:btnLogout" value="Logout" id="Header1_btnLogout" style="font-size:XX-Small;" /></TD>
	</TR>
</TABLE>
</TD>
				</TR>
				<TR>
					<TD colSpan="3">
						<TABLE id="Table3" style="WIDTH: 656px; HEIGHT: 846px" cellSpacing="0" cellPadding="3"
							width="656" border="0">
							<TBODY class="tb8">
								<TR>
									<TD class="hn11" style="WIDTH: 434px; HEIGHT: 19px" colSpan="2">Editing Vendor 
										Information&nbsp;&nbsp;&nbsp;
										<input type="submit" name="btnDetails" value="Back to Details" id="btnDetails" style="font-size:XX-Small;" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 19px" bgColor="#ffffcc">Date Modified:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 19px" bgColor="#ffffcc"><span id="lblModify">3/14/2008 9:07:08 AM</span></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 19px" bgColor="#ffffcc">Vendor ID:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 19px" bgColor="#ffffcc"><span id="VendorNumber">1</span></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 19px" bgColor="lightgrey">Division Name:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 19px" bgColor="lightgrey"><input name="DivisionName" type="text" value="BP" id="DivisionName" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 19px" bgColor="lightgrey">Department Name:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 19px" bgColor="lightgrey"><input name="DeptName" type="text" value="n/a" id="DeptName" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 19px" bgColor="#ffffcc">Vendor Code:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 19px" bgColor="#ffffcc"><input name="VendorCode" type="text" value="GPW1      " id="VendorCode" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 3px" vAlign="top" bgColor="lightgrey">Vendor Name:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 3px" bgColor="lightgrey"><input name="VendorName" type="text" value="Bluelinx" id="VendorName" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 73px" bgColor="#ffffcc">Status:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 73px" bgColor="#ffffcc">
										<P><span id="message">300       </span></P>
										<P><table id="CurrentStatus" border="0" style="font-size:X-Small;width:96px;">
	<tr>
		<td><input id="CurrentStatus_0" type="radio" name="CurrentStatus" value="100" onclick="__doPostBack('CurrentStatus_0',')" language="javascript" /><label for="CurrentStatus_0">Completed</label></td>
	</tr><tr>
		<td><input id="CurrentStatus_1" type="radio" name="CurrentStatus" value="200" checked="checked" onclick="__doPostBack('CurrentStatus_1',')" language="javascript" /><label for="CurrentStatus_1">In Progress</label></td>
	</tr><tr>
		<td><input id="CurrentStatus_2" type="radio" name="CurrentStatus" value="300" onclick="__doPostBack('CurrentStatus_2',')" language="javascript" /><label for="CurrentStatus_2">Problem</label></td>
	</tr>
</table><span id="RequiredFieldValidator1" controltovalidate="CurrentStatus" errormessage="RequiredFieldValidator" evaluationfunction="RequiredFieldValidatorEvaluateIsValid" initialvalue="" style="color:Red;width:200px;visibility:hidden;">You Must Choose a Status before saving!</span></P>
									</TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 18px" bgColor="lightgrey"></TD>
									<TD style="WIDTH: 48px; HEIGHT: 18px" bgColor="lightgrey"></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 6px" vAlign="top" bgColor="#ffffcc">Joined:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 6px" bgColor="#ffffcc">
										<P><input name="Joined" type="text" value="Jan-98" id="Joined" /></P>
									</TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 18px" bgColor="lightgrey">SKU:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 18px" bgColor="lightgrey"><input name="SKU" type="text" value="n/a       " id="SKU" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 18px" bgColor="#ffffcc">EDI:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 18px" bgColor="#ffffcc"><input name="EDI" type="text" value="Y         " id="EDI" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 20px" bgColor="lightgrey">Rebate:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 20px" bgColor="lightgrey"><input name="RBT" type="text" value="N         " id="RBT" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 18px" bgColor="#ffffcc"></TD>
									<TD style="WIDTH: 48px; HEIGHT: 18px" bgColor="#ffffcc"></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 21px" bgColor="#cc9966"><STRONG>Contact Information</STRONG></TD>
									<TD style="WIDTH: 48px; HEIGHT: 21px" bgColor="#cc9966"></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 21px" bgColor="#ffffcc">Contact Name:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 21px" bgColor="#ffffcc"><input name="ContactName" type="text" value="Terry Algren, Larry Frey, Meg Hulme" id="ContactName" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 19px" bgColor="#ffffcc">Contact Phone:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 19px" bgColor="#ffffcc"><input name="ContactPhone" type="text" value="1770221254,          770-221-2745, 770-221-2781" id="ContactPhone" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 32px" bgColor="#ffffcc">Contact Fax:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 32px" bgColor="#ffffcc"><input name="ContactFax" type="text" value="TEST" id="ContactFax" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 32px" bgColor="#ffffcc">Email Address:</TD>
									<TD style="WIDTH: 48px; HEIGHT: 32px" bgColor="#ffffcc"><input name="EmailAddress" type="text" value="tpalgren@bluelinxco.com; mchulme@bluelinxsco.com" id="EmailAddress" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 32px" bgColor="#ffffcc"><input type="submit" name="btnSave" value="Save Data" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="btnSave" />&nbsp;&nbsp;
										<input type="submit" name="btnCancel" value="Cancel" id="btnCancel" />&nbsp;&nbsp;
										</TD>
									<TD style="WIDTH: 48px; HEIGHT: 32px" bgColor="#ffffcc"></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 19px" bgColor="#cc9966"><STRONG>Comments</STRONG></TD>
									<TD style="WIDTH: 48px; HEIGHT: 19px" bgColor="#cc9966"></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 434px; HEIGHT: 20px" bgColor="#ffffcc" colSpan="2"><table cellspacing="0" rules="all" bordercolor="#CC9966" border="1" id="DGComments" style="background-color:White;border-color:#CC9966;font-family:Arial;
font-size:XX-Small;width:680px;border-collapse:collapse;">
	<tr style="color:White;background-color:#CC9966;font-family:Arial;font-size:
X-Small;font-weight:bold;">
		<td>&nbsp;</td><td>Comment</td><td>Comment Modified/Added</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl2$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl2_Label3">Tom Spoke with Meg Holme at Bluelinx.  Went over again what we need. He mentioned Inovis as being a common practice that we both use.  She is going to check to see where things are and get back to him.Tom to follow up with Meg. 2/29 CH</span>
													</td><td>
														<span></span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl3$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl3_Label3">werwerwer</span>
													</td><td>
														<span>3/13/2008 9:57:09 AM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl4$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl4_Label3">Reearwerwerwer</span>
													</td><td>
														<span>3/13/2008 9:58:19 AM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl5$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl5_Label3">TEST</span>
													</td><td>
														<span>3/11/2008 12:58:02 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl6$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl6_Label3">Test3</span>
													</td><td>
														<span>3/11/2008 3:11:49 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl7$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl7_Label3">Lisa</span>
													</td><td>
														<span>3/11/2008 3:50:10 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl8$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl8_Label3">Testing again</span>
													</td><td>
														<span>3/13/2008 9:58:42 AM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl9$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl9_Label3">efrwaerwerwer</span>
													</td><td>
														<span>3/13/2008 10:15:09 AM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl10$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl10_Label3">Lysa</span>
													</td><td>
														<span>3/13/2008 10:21:25 AM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl11$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl11_Label3">addig a new comment</span>
													</td><td>
														<span>3/13/2008 11:44:01 AM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl12$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl12_Label3">Adding another new comment</span>
													</td><td>
														<span>3/13/2008 11:44:14 AM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl13$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl13_Label3">Test3</span>
													</td><td>
														<span>3/11/2008 3:12:42 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl14$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl14_Label3">Tst4</span>
													</td><td>
														<span>3/11/2008 3:12:49 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl15$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl15_Label3">Test7</span>
													</td><td>
														<span>3/11/2008 3:13:04 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl16$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl16_Label3">Lisa</span>
													</td><td>
														<span>3/11/2008 3:38:24 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl17$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl17_Label3">Lisa</span>
													</td><td>
														<span>3/11/2008 3:39:02 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl18$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl18_Label3">Lisa</span>
													</td><td>
														<span>3/11/2008 4:15:01 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl19$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl19_Label3">Lisa</span>
													</td><td>
														<span>3/11/2008 3:40:26 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl20$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl20_Label3">Lisa</span>
													</td><td>
														<span>3/11/2008 3:43:54 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl21$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl21_Label3">Lisa</span>
													</td><td>
														<span>3/11/2008 3:48:26 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl22$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl22_Label3">christina</span>
													</td><td>
														<span>3/11/2008 4:38:30 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl23$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl23_Label3">Lisa</span>
													</td><td>
														<span>3/11/2008 3:49:54 PM</span>
													</td>
	</tr><tr style="color:Black;border-color:#804000;border-style:Dotted;font-family:
Arial;font-size:X-Small;">
		<td><a href="javascript:__doPostBack('DGComments$_ctl24$_ctl0',')" style="color:Black;">Edit</a></td><td>
														<span id="DGComments__ctl24_Label3">Janice</span>
													</td><td>
														<span>3/13/2008 9:38:09 AM</span>
													</td>
	</tr>
</table></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 189px; HEIGHT: 20px" bgColor="#ffffcc" colSpan="2"><textarea name="AddlComments" id="AddlComments" style="height:68px;width:672px;"></textarea><input type="submit" name="btnAddComment" value="Add New Comment" id="btnAddComment" /></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 10px" bgColor="#ffffcc"></TD>
									<TD style="WIDTH: 48px; HEIGHT: 10px" bgColor="#ffffcc"></TD>
								</TR>
								<TR>
									<TD style="WIDTH: 251px; HEIGHT: 14px" bgColor="#ffffcc"></TD>
									<TD style="WIDTH: 48px; HEIGHT: 14px" bgColor="#ffffcc"></TD>
								</TR>
							</TBODY>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD colSpan="3">
<P>
	<TABLE id="Table2" cellSpacing="0" cellPadding="0" width="100%" border="0">
		<TR>
			<TD style="HEIGHT: 20px" bgColor="#330000"></TD>
		</TR>
	</TABLE>
</P>
<P>&nbsp;
</P>
</TD>
				</TR>
			</TABLE>
		
<script language="javascript" type="text/javascript">
<!--
	var Page_Validators =  new Array(document.all["RequiredFieldValidator1"]);
		// -->
</script>

			
<script language="javascript" type="text/javascript">
<!--
var Page_ValidationActive = false;
if (typeof(clientInformation) != "undefined" && clientInformation.appName.indexOf("Explorer") != -1) {
    if (typeof(Page_ValidationVer) == "undefined")
        alert("Unable to find script library '/aspnet_client/system_web/1_1_4322/WebUIValidation.js'. Try placing this file manually, or reinstall by running 'aspnet_regiis -c'.");
    else if (Page_ValidationVer != "125")
        alert("This page uses an incorrect version of WebUIValidation.js. The page expects version 125. The script library is " + Page_ValidationVer + ".");
    else
        ValidatorOnLoad();
}

function ValidatorOnSubmit() {
    if (Page_ValidationActive) {
        return ValidatorCommonOnSubmit();
    }
    return true;
}
// -->
</script>
        

		</form>
	</body>
</HTML>

<script language="JavaScript">
<!--
var SymRealOnLoad;
var SymRealOnUnload;

function SymOnUnload()
{
  window.open = SymWinOpen;
  if(SymRealOnUnload != null)
     SymRealOnUnload();
}

function SymOnLoad()
{
  if(SymRealOnLoad != null)
     SymRealOnLoad();
  window.open = SymRealWinOpen;
  SymRealOnUnload = window.onunload;
  window.onunload = SymOnUnload;
}

SymRealOnLoad = window.onload;
window.onload = SymOnLoad;

//-->
</script>
 
Code:
<input id="CurrentStatus_2" type="radio" name="CurrentStatus" value="300" onclick="__doPostBack('CurrentStatus_2','')" language="javascript" />
OK, the line above is the input element that I mentioned would be written out to the page, which looks to be correct.

So, if it's not that, then it's something to do with how you are reading the value. Please paste the full code-behind page.



-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
okay-- here is the page_load sub where this is all happening:

Code:
    Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            If Not Page.IsPostBack Then
                SQLStatement.Text = _SQLStmt
                BindGrid()
                DGComments.DataSource = GetTableData()
                DGComments.DataBind()
            End If
            VendorID = Request.QueryString("VendorID").ToString
            Dim myDate As String = DateTime.Now.ToString()
            lblModify.Text = myDate

            If Not Page.IsPostBack Then
                Dim myConn As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
                Dim MyCmd As New SqlCommand("SELECT [VendorID],[DivisionName],[DeptName],[VendorName],[VendorCode],[CurrentStatus],[Joined],[SKU],[EDI],[RBT],[ContactName],[ContactPhone],[ContactFax],[EmailAddress]FROM [ENAPTEST].[dbo].[tblVendorInfo] Where VendorID =  @VendorID", myConn)
                MyCmd.CommandType = CommandType.Text
                MyCmd.Parameters.Add(New SqlParameter("@VendorID", SqlDbType.Int, 4)).Value = Convert.ToString(VendorID)
                myConn.Open()
                Dim Result As SqlDataReader = MyCmd.ExecuteReader(CommandBehavior.CloseConnection)
                Result.Read()
                VendorNumber.Text = Result("VendorID").ToString()

                If Not Result.IsDBNull(0) Then
                    DivisionName.Text = Result("DivisionName").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    DeptName.Text = Result("DeptName").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    VendorName.Text = Result("VendorName").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    VendorCode.Text = Result("VendorCode").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    Joined.Text = Result("Joined").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    SKU.Text = Result("SKU").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    EDI.Text = Result("EDI").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    RBT.Text = Result("RBT").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    ContactName.Text = Result("ContactName").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    ContactPhone.Text = Result("ContactPhone").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    ContactFax.Text = Result("ContactFax").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    EmailAddress.Text = Result("EmailAddress").ToString()
                End If
                If Not Result.IsDBNull(0) Then
                    CurrentStatus.Items.FindByText(Result("CurrentStatus").ToString).Selected = True
                End If
                myConn.Close()
            End If
        Catch ex As Exception
            Response.Write("Error: " & ex.Message)
        End Try

    End Sub

Thanks... I appreciate your help...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top