I'm not even sure if PostBackUrl is the command that I want/need. Here is my situation:
In a form on webpage "A" I have a Label, a TextBox, and a LinkButton
I want users to be able to click the linkbutton, which takes them to webpage "B" so they can choose a classcode from a gridview table, I then want that ClassCode to go back into the TextBox on webpage "A"
Could somebody point me to an example of how to do this please?
Here is my Code So Far
findClassCode.aspx
addOIIPart.aspx
In a form on webpage "A" I have a Label, a TextBox, and a LinkButton
I want users to be able to click the linkbutton, which takes them to webpage "B" so they can choose a classcode from a gridview table, I then want that ClassCode to go back into the TextBox on webpage "A"
Could somebody point me to an example of how to do this please?
Here is my Code So Far
findClassCode.aspx
Code:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<script runat="server">
Sub ChangeTable_Click(ByVal Source As Object, ByVal E As EventArgs)
Dim YouSelected As String
YouSelected = "SELECT [code] as Code, [description]as Description FROM [ClassCodes] WHERE [classCodeType]=" & selectDD.SelectedValue.ToString & "ORDER BY [Description]"
SqlDataSource2.SelectCommand = YouSelected
End Sub
</script>
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] >
<head id="Head1" runat="server">
<title>Select A Class Code</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="selectL" runat="server" Text="Select one:"></asp:Label><br />
<asp:DropDownList ID="selectDD" runat="server" DataSourceID="SqlDataSource1"
DataTextField="Description" DataValueField="classCodeType">
</asp:DropDownList>
<asp:Button ID="changeTable" onClick="changeTable_Click" runat="server" Text="Select" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PartsInventoryConnectionString1 %>"
SelectCommand="SELECT [Description], [classCodeType] FROM [ClassCodeTypes] ORDER BY [Description]">
</asp:SqlDataSource>
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns=False CellPadding="4" DataSourceID="SqlDataSource2"
ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:ButtonField Text="Select" />
<asp:BoundField DataField="Code" Visible="False" />
<asp:BoundField DataField="Description" AccessibleHeaderText="Class Codes" ApplyFormatInEditMode="True" HeaderText="Class Codes" ReadOnly="True" SortExpression="Description" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:PartsInventoryConnectionString1 %>"
SelectCommand="SELECT [code] as Code, [description]as Description FROM [ClassCodes] WHERE [classCodeType]=1 ORDER BY [Description]">
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
addOIIPart.aspx
Code:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] >
<head runat="server">
<title>Add Parts</title>
<script runat="server">
</script>
</head>
<body alink="#0000">
<form id="form1" runat="server">
<div>
<asp:Label ID="productCodeL" runat="server" Text="Product Code: " AssociatedControlID="productCodeTB"></asp:Label>
<asp:TextBox ID="productCodeTB" runat="server" MaxLength=7></asp:TextBox><br />
<asp:Label ID="classCodeL" runat="server" Text="Class Code: " AssociatedControlID="classCodeTB"></asp:Label>
<asp:TextBox ID="classCodeTB" runat="server" MaxLength=5></asp:TextBox>
<asp:LinkButton ID="classCodeButton" runat="server" PostBackUrl="~/html/findClassCode.aspx">find...</asp:LinkButton><br />
<asp:Label ID="commodityCodeL" runat="server" Text="Commodity Code: " AssociatedControlID="commodityCodeTB"></asp:Label>
<asp:TextBox ID="commodityCodeTB" runat="server" MaxLength=10></asp:TextBox><br />
<asp:Label ID="OIIPartsIDL" runat="server" Text="Part Number: " AssociatedControlID="OIIPartsIDTB"></asp:Label>
<asp:TextBox ID="OIIPartsIDTB" runat="server" MaxLength=6></asp:TextBox><br />
<asp:Label ID="revisionL" runat="server" Text="Revision: " AssociatedControlID="revisionTB"></asp:Label>
<asp:TextBox ID="revisionTB" runat="server" MaxLength=2></asp:TextBox><br />
<asp:Label ID="subItemOfL" runat="server" Text="Sub-Item-Of: " AssociatedControlID="subItemOfTB"></asp:Label>
<asp:TextBox ID="subItemOfTB" runat="server" MaxLength=6></asp:TextBox><br />
<asp:Label ID="oldPartNumberL" runat="server" Text="Old Part Number: " AssociatedControlID="oldPartNumberTB"></asp:Label>
<asp:TextBox ID="oldPartNumberTB" runat="server" MaxLength=20></asp:TextBox><br />
<asp:Label ID="ownerL" runat="server" Text="Owner: " ToolTip="Name of employee who enters the Part" AssociatedControlID="ownerTB"></asp:Label>
<asp:TextBox ID="ownerTB" runat="server" MaxLength=20></asp:TextBox><br />
<br />
<asp:Label ID="descriptionL" runat="server" Text="Description:" AssociatedControlID="descriptionTB"></asp:Label> <br />
<asp:TextBox ID="descriptionTB" runat="server" Height="100px" Width="300px" MaxLength=200></asp:TextBox><br />
<br />
<asp:Label ID="extendedDescriptionL" runat="server" Text="Extended Description:" AssociatedControlID="extendedDescriptionTB"></asp:Label>
<br />
<asp:TextBox ID="extendedDescriptionTB" runat="server" Height="200px" Width="500px"></asp:TextBox><br />
<br />
<asp:Label ID="materialL" runat="server" Text="Material: " AssociatedControlID="materialTB"></asp:Label>
<asp:TextBox ID="materialTB" runat="server"></asp:TextBox>
<br />
<asp:Label ID="specsL" runat="server" Text="Specs: " AssociatedControlID="specsTB"></asp:Label>
<asp:TextBox ID="specsTB" runat="server"></asp:TextBox>
<br />
<asp:Label ID="weightL" runat="server" Text="Weight: " AssociatedControlID="weightTB"></asp:Label>
<asp:TextBox ID="weightTB" runat="server"></asp:TextBox><br />
<asp:Label ID="fabricatedL" runat="server" Text="Fabricated: " AssociatedControlID="fabricatedCB"></asp:Label>
<asp:CheckBox ID="fabricatedCB" runat="server" />
<br />
<asp:Label ID="stockedL" runat="server" Text="Stocked: " AssociatedControlID="stockedCB"></asp:Label>
<asp:CheckBox ID="stockedCB" runat="server" /><br />
<asp:Label ID="isToolOrFixtureL" runat="server" Text="Tool/Fixture: " AssociatedControlID="isToolOrFixtureCB"></asp:Label>
<asp:CheckBox ID="isToolOrFixtureCB" runat="server" /><br />
<asp:Label ID="unitOfMeasureL" runat="server" Text="Unit Of Measure: " AssociatedControlID="unitOfMeasureTB"></asp:Label>
<asp:TextBox ID="unitOfMeasureTB" runat="server"></asp:TextBox><br />
<asp:Label ID="specSheetOrDwgNumL" runat="server" Text="Spec. Sheet or Dwg Num: " AssociatedControlID="specSheetOrDwgNumLTB"></asp:Label>
<asp:TextBox ID="specSheetOrDwgNumLTB" runat="server"></asp:TextBox><br />
<asp:Label ID="OEMNameL" runat="server" Text="OEM Name: " AssociatedControlID="OEMNameTB"></asp:Label>
<asp:TextBox ID="OEMNameTB" runat="server"></asp:TextBox>
<br />
<asp:Label ID="OEMPartNumberL" runat="server" Text="OEM Part Number: " AssociatedControlID="oldPartNumberTB"></asp:Label>
<asp:TextBox ID="OEMPartNumberTB" runat="server"></asp:TextBox>
<br />
<asp:Label ID="drawnByL" runat="server" Text="Drawn By: " AssociatedControlID="drawnByTB"></asp:Label>
<asp:TextBox ID="drawnByTB" runat="server"></asp:TextBox><br />
<asp:Label ID="checkedByL" runat="server" Text="Checked By: " AssociatedControlID="checkedByTB"></asp:Label>
<asp:TextBox ID="checkedByTB" runat="server"></asp:TextBox><br />
<asp:Label ID="approvedByL" runat="server" Text="Approved By: " AssociatedControlID="approvedByTB"></asp:Label>
<asp:TextBox ID="approvedByTB" runat="server"></asp:TextBox><br />
<asp:Label ID="dwgNumberL" runat="server" Text="Dwg Number: " AssociatedControlID="dwgNumberTB"></asp:Label>
<asp:TextBox ID="dwgNumberTB" runat="server"></asp:TextBox><br />
<asp:Label ID="dwgRevisionL" runat="server" Text="Dwg Revision: " AssociatedControlID="dwgRevisionTB"></asp:Label>
<asp:TextBox ID="dwgRevisionTB" runat="server"></asp:TextBox><br />
<asp:Label ID="dwgLocationL" runat="server" Text="Dwg Location: " AssociatedControlID="dwgLocationTB"></asp:Label>
<asp:TextBox ID="dwgLocationTB" runat="server"></asp:TextBox><br />
<br />
<asp:Label ID="notesL" runat="server" Text="Notes: " AssociatedControlID="notesTB"></asp:Label>
<br />
<asp:TextBox ID="notesTB" runat="server" Height="200px" Width="500px"></asp:TextBox>
</div>
</form>
</body>
</html>