How to set value that get from the other web page for TextBox when insert into database ?

Hi,

  I want to insert into database a record , one textbox value get from use input, the other 2 get from the web page. how I should write the code? here is the code:

--------------------------VB 

 Response.Redirect("~/TE/Print test.aspx?id=" & DetailsView1.DataKey("ID") & "&designer_id=" & Staff.IdByLogin(User.Identity.Name))

form this I get id and designer_id in TE/Print test.aspx.

----------------------------ASPX

 <asp:FormView ID="FormView2" runat="server" DataKeyNames="ID" DataSourceID="AountInsert_ODS">
          
            <InsertItemTemplate>
            
                prospect_id:
                <asp:TextBox ID="prospect_idTextBox" runat="server" Text='<%# Bind("PROSPECT_ID") %>' >
                </asp:TextBox><br />
                designer_id:
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DESIGNER_ID") %>' >
                </asp:TextBox><br />
                AMOUNT:
                <asp:TextBox ID="AMOUNTTextBox" runat="server" Text='<%# Bind("AMOUNT") %>'>
                </asp:TextBox><br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                    Text="Insert" OnClick="test">
                </asp:LinkButton>
                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="Cancel">
                </asp:LinkButton>
            </InsertItemTemplate>

----------------How to get the value for the textbox "prospect_idTextBox " and "TextBox1", they donot need input by user?

Thanks in advance!

Zhanying

 

0
zhanying
7/6/2007 3:03:48 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

5 Replies
919 Views

Similar Articles

[PageSpeed] 4

Hi,

It seems you want to access a nested control (a textbox inside a FormView control). You can use the following code:

Dim ctl as TextBox= CType( FormView2.Controls(0).FindControl("prospect_idTextBox"), TextBox)

Similarly you can use the same code to find any nested control. Note that I am using FormView2.Controls(0) to get the InsertItemTemplate first and then get its child controls.

Hope this helps,

Vivek


Social Networking Platform in ASP.NET || Join now: CodeASP.NET Community

Please mark the most helpful reply/replies as "Answer".
0
vivek_iit
7/6/2007 7:11:30 AM

Hi  Vivek,

  Thank you for your answer. I tried your solution, but I donot know what it the name of the VB function?  I want to get the value from ---Request.QueryString("id") , how I can let it display in the textbox when I click the "insert" button ? or how can I get the value when I insert the database ? in fact, it does not need to display, but I donot know how to insert into a record database, I want to let user input only the "amount" value, how should I do ?

Could you please give me more detail ?

Thanks and best regards,a

Zhanying

0
zhanying
7/6/2007 7:41:00 AM

I think I am not getting your problem. Do you want to get some value from the query string and insert it in the DB? Please explain in detail the exact issue you are facing.

Thanks,

Vivek


Social Networking Platform in ASP.NET || Join now: CodeASP.NET Community

Please mark the most helpful reply/replies as "Answer".
0
vivek_iit
7/8/2007 5:51:36 PM

Hi, zhanying:

You can achieve this by adding an event handler to the PreRender event of FormView like:

Protected Sub FormView1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.PreRender
        If (FormView1.CurrentMode = FormViewMode.Insert) Then
            Dim textbox As TextBox = CType(FormView1.FindControl("TextBox1"), TextBox)
            textbox.Text = Request.QueryString("id")
            Dim textbox1 As TextBox = CType(FormView1.FindControl("prospect_idTextBox"), TextBox)
            textbox1.Text = Request.QueryString("designer_id")
        End If
    End Sub
 Please have a try.
Sincerely,
Techie Zhang
Microsoft Online Community Support
0
Techie
7/10/2007 9:36:46 AM

Hi Techie,

  Thank you very much! it works well.

Best regards,

Zhanying

0
zhanying
7/10/2007 10:07:14 AM
Reply:

Similar Artilces:

How to get the HREF value of the Anchor tag in a web page using the web browser control in vb.net
Hi Friends,               i have a webserver control in my application.i load the web browser control on a button click using the below code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click                AxWebBrowser1.Navigate("http://www.rateitall.com/i-322335-.aspx", False) End sub once the page is loaded in the browser i want the <a> HREF value in that page.For example if that page has ...

When i open my page I want set file control and textboxes fields with values in page load event
 Hi , I have input text and  inputFile  control  <input type="text" id=" txtServerName" runat="server"/><input type="text" id="FileName" name="FileName" runat="server" /><input type="file" id="FileName1" name="FileName1" class="fileupload" runat="server" size="1" onpropertychange="FileName_PropertyChange();"> and i  applied this  css and javascript <script type="text/javascript"> &...

using javascript getting value from textbox when edit button is clicked and both controls are present in gridview control
Hi All using javascript I want to get value  from textbox when edit button is clicked and both controls that is texbox and button are present in gridview control .Alok Hi aloksinha83, Please see this post: http://forums.asp.net/t/1069245.aspx Thanks,Qin Dian TangMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

problem with get value from textbox after get it value in load page
hi every one  i have problem with my web site when i get textbox value in load page   and Changed textbox the page do not take last value .   it take value in load page   this is code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)   TextBox1.Text = "aa" End SubProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox(TextBox1.Text) End Sub   when i press button message write "aa" while i changed the textbox   please if enyone knowen help me &nbs...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

How to get Textbox value in web user control?
Hi friends,I created a web user control with only one textbox.(textbox.ascx) and textbox id=" txtSimple"textbox user control having some property. another user control with button(button.ascx) next i use two textbox usercontrol and one button usercontrol in sample.aspx. when i click button at that time call the required field validate property in textbox user control.in property have following code.public bool RequireValidate    {        set        {     &nbs...

How to pass textbox control value from UserControl page(ascx) to Page Control(aspx).
I have 2 files(aspx and ascx). the aspx page  has a Web user control(ascx) in it.Once the button control click(in aspx) I want to get the value from the textbox(ascx) controland pass it to label control in aspx page.Can somebody help with this and please use VB.Thanks A simple search would have turn up many different solutions.  The easiest is to just expose the textbox value as a property in your control.  Then you can retrieve that value on the aspx page. Add this to your control: Public Property TextBoxValue() As String   Get   &...

Get values set by javascript to .net enabled textbox
I have a bit of javasript that writes a value to a text box.  The text box is read only. Textbox code:<input type="text" id="txtColor1" runat="server" readonly="readonly" size="6" /> Snippet from javascript functioncolorBox = document.getElementById('<%= txtColor1.ClientID %>');colorBox.value = colorCode;  Code behind:string color1 = txtColor1.Value Whenever I attempt to get the value out of the text box after it has been changed by the javascript, it always reverts back to the old data and not the new. Anyo...

getting/setting a value in a web user control (ascx)
I have created a simple web user control that has a textbox and a calendar on it. When the user clicks on the calendar, the textbox is filled with the relevant date. What I want to do is be able to get that date from the parent webpage. I also want to be able to set a couple of variables saying whether a requiredFieldValidator is enables, and there is a default date. Hopefully, the answer to above would help in this aswell. Can anyone help?Intelligence is a burden.Jagdip Singh AjimalManchester (and yes, I am a Manchester United fan) You must declare a public property in your User ...

Custom web control. Get Textbox.text value
Hi I have created a custom web control that extends the CheckBoxList control. It basically is a CheckBoxList control that has a TextBox added to the end of each CheckBox. It looks like the following after it has being bound to a database table column. I need to be able to retrieve the values in the corresponding TextBox when a CheckBox is selected. I tried storing each TextBox in an ArrayList but it is always empty when I try and check it. I am pretty new to ASP and am obviously missing something. Has anybody here got any tips or ideas on how I could retrieve the data from the TextBoxes...

cant get web user control page value
i have a page web user control (ascx file), name =criteria in the ascx page i have a dropdownlist, name = Field1 the ascx page have a function Function GetValue() as string    Return Field1.SelectedItem.text Ebd Function now i include the ascx file to my web form with button ''''button at the web form not ascx file in button click events Dim Str as String Dim objCriteria as new Criteria  ' Criteria is ascx page class name Str = objCriteria.GetValue But at runtime i get an error say null reference exception how to solve the problem? i using VS 2005 and .ne...

Cannot get value from an input textbox to a listbox web control??
I am about to go nuts because I really have not done any Asp.Net programming up until now. I have mainly done desktop applications. I am trying to take the textbox in the page and pass the contents of it to the listbox on the same page. I cannot get the values from the textbox to the listbox. Below is my code for the aspx page and also for my code behind page. Can someone please tell and show me where I am going wrong? aspx page:<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AspNetPolyDraw.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...

How to set textbox control value in ascx from aspx page
 Hello Everyone,I think this probnlem is already posted on the forum. But i can't find any solution about it so i am posting it. I am finding probelm to set TextBox control value in .ascx control. My scnario is that: I am dynamically adding ascx control in aspx page means that i've 3 users in list and i want to show every users credentials. I am doing like that i added textbox control in ascx control writing get set properties for each web control.In aspx page i am setting these values by traversing list. It is working fine. But i am finding problem that when i try to change val...

Getting values from window based control to web page.
I have a window based control and I am using the control in a web page and now I am doing in that window control is to showing the multiple selected files from open dialogue box. And the selected file's path is showing in the list box. But the problem is that, how can I get selected files path from window based control in a webpage. When I use property it shows me an undefined thing. Although the list box is showing me a multiple selecting files in the list box.   What you're describing is probably security-driven by the browser and windows control interaction. ...

Web resources about - How to set value that get from the other web page for TextBox when insert into database ? - asp.net.presentation-controls

Database - Wikipedia, the free encyclopedia
... requiring information. For example, modelling the availability of rooms in hotels in a way that supports finding a hotel with vacancies. Database ...

Database - Wikipedia, the free encyclopedia
A database is an organized collection of data . The data are typically organized to model aspects of reality in a way that supports processes ...

Social Side of Code, Database CI and REST API Testing in Methods & Tools Winter 2015 issue
... for software developers, testers and project managers – has published its Winter 2015 issue that discusses the social side of code, database ...

Dodgy database exposes details of 191 million US voters
... years, there's a high chance that your personal details are now out in the wild. Security researcher Chris Vickery found a misconfigured database ...

Huge database of 191 million U.S. voters found on the open Internet
... such bulk information online, a recent discovery seems to indicate. According to VentureBeat , a security researcher found the exposed database ...

IDG Contributor Network: Shrinking an already ginormous SharePoint database transaction log
Last month, I wrote about how to avoid having ginormous transaction logs within SharePoint databases. But what if it’s too late, and your files ...

Massive Voter Database Left Open For Public Consumption
Gosh, we could have avoided all the angst about the Clinton/Sanders voter database breach if only we'd known about this major database , accessible ...

Database configuration issues expose 191 million voter records
A misconfigured database has led to the disclosure of 191 million voter records. The database, discovered by researcher Chris Vickery, doesn't ...

Botched database leaks records for 191 million voters
... sometime this century? If so, your personal info may be out in the open. Researcher Chris Vickery has discovered that a badly configured database ...

191 Million US Voter Registration Records Leaked In Mystery Database
A huge database of 191 million US citizens is uncovered. But no one knows who carelessly left it open, whilst the FBI have been contacted.

Resources last updated: 1/17/2016 10:23:18 AM