Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6672673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:32:09+00:00 2026-05-26T03:32:09+00:00

Hi I’m trying to automatically pass a value from a textbox into a details

  • 0

Hi I’m trying to automatically pass a value from a textbox into a details view query but nothing is showing up. Heres what I’ve got:

ASP CODE:

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

 </asp:Content>
 <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
     <asp:TextBox ID="test" runat="server"></asp:TextBox>

&nbsp;
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
    DataSourceID="SqlDataSource1" Height="50px" Width="125px">
    <Fields>
        <asp:BoundField DataField="blogid" HeaderText="blogid" 
            SortExpression="blogid" />
        <asp:BoundField DataField="myfriendid" HeaderText="myfriendid" 
            SortExpression="myfriendid" />
        <asp:BoundField DataField="inputdate" HeaderText="inputdate" 
            SortExpression="inputdate" />
        <asp:BoundField DataField="content" HeaderText="content" 
            SortExpression="content" />
    </Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:test2ConnectionString %>" 
    SelectCommand="SELECT * FROM [BLOG] WHERE ([blogid] = @blogid)">
    <SelectParameters>
        <asp:FormParameter FormField="test" Name="blogid" Type="Double" />
    </SelectParameters>
</asp:SqlDataSource>
</asp:Content>

c# code:

namespace Log_In.Account
{
     public partial class Page2_1 : System.Web.UI.Page
     {
         protected void Page_Load(object sender, EventArgs e)

        {

        string EmpId = Request.QueryString["blog_ID"];
        test.Text = blog_ID;
        DetailsView1.DataBind();
    }
}

}

Any ideas on how i can fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:32:10+00:00Added an answer on May 26, 2026 at 3:32 am

    Actually there are a few errors in your code.

    Arguably the main error is that you are use FormParameter for referencing test textbox value. Such technique works well only if that textbox or another referenced server control placed in form tag directly without no parent server controls those implement INamingContainer interface like asp:ContentPlaceholder control. In other words you can’t use FormParameter if you use a master pages.

    That’s because each parent control that implements INamingContainer participates in building children control’s UniqueIDs. Those ids used for retrieving posted values from the Request.Form dictionary. So as far as the test textbox placed in a Content control it’s UiqueID looks like ctl00$MainContent$test . Of course you set this id on FormParameter’s FormField property value but this looks very ugly.

    To resolve this issue you may use a ControlParameter instead of FormParameter. like this:

    <asp:ControlParameter ControlID="test" Name="blogid" 
        PropertyName="Text" Type="Double" />
    

    The second error is maybe the most common error in data binding : you are not wrap data binding code by !IsPostback condition check.

    But even you will add check mentioned above your code still will not work well with a FormParameter as the Request.Form dictionary already formed from values of form elements posted to the HTTP request body, with a form using the POST method.

    To resolve this error you can rewrite Page_Load body as below with conduction of using ControlParameter:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            test.Text = Request.QueryString["blog_ID"];
        }
    }
    

    Draw attention that you don’t need to call DetailsView1.DataBind method explicitly as all page’s controls databindings processed after Page_Load.

    If it’s was too hard to understand my English 🙂 please follow this link to realize difference between FormParameter and ControlParameter: SqlDataSource control and Master Page problem

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.