Want to set TextBoxs' value that's inside FormView - Please Help

Hi,

 

I have a FormView with DefaultMode as "Edit". I want to set one of its TextBox's value programmatically. I am trying something like this on the

Page_Load event of the page -

 

Dim tb As TextBox = DirectCast(FormView1.FindControl("txtDomainId"), TextBox)

tb.Text = Request.Querystring("Domain")

 It throws me a an error saying - Object reference not set to an instance of an object.

Any clue what's wrong here. Please help. Thanks guys for your inputs.

0
shaly
12/12/2006 10:13:37 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

2 Replies
657 Views

Similar Articles

[PageSpeed] 38

why not do this?

 

<asp:Textbox ID="Textbox1" runat="server" Text='<%= Request("QSname") %>' />
 


Jared Roberts
Lead Application Developer
0
rojay12
12/13/2006 4:00:00 AM

hi shaly,

seems this error is because findcontrol was not able to find your control

Dim tb As TextBox = DirectCast(FormView1.FindControl("txtDomainId"), TextBox), check tb while debugging it might be null.

thanks,

satish.


Kind Attn: If a reply to your post helped you, kindly mark it as Answered.
__________________________________________________
Please save Animals Help World Society For Protection Of Animals,
Protect these speechless creatures of GOD
0
satish_nagdev
12/13/2006 4:51:33 AM
Reply:

Similar Artilces:

Help! I cannot access the DataGrid's ItemTemplate's LinkButton's Text Atrribute 's Value!!!!!!!!!!!
I write a datagrid's ItemDataBound method as follows:   private void dgTable_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)  {   if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)   {    if(!isRole("Manager"))    {     LinkButton tmp = (LinkButton)e.Item.FindControl("lbPassed");     if(tmp.Text == "Passed")     {      ((LinkBu...

Urgent Help! How to get data from child's gridview to parent's textbox
 Hello Sir,Would you please advise me, how can I get the data from child gridview to parent textbox.For example, I have select 2 row in child's datagrid the values are "A" and "B" then click add and "A B" appears in the same parent's textbox. Thanks in advance!   Anyone please help me. How to get the data from gridview on popup page to textbox on the main page. Thank you so much!!!! Hi Novox , Please check my sample :   <asp:GridView ID="GridView1" runat="server" Height="227px" Width...

Urgent Help! How to get data from child's gridview to parent's textbox #2
 Hello Sir,Would you please advise me, how can I get the data from child gridview to parent textbox?For example, I have select 2 row in child's datagrid the values are "A" and "B" then click add and "A B" appears in the parent's textbox. I think this must use JavaScript to make this happen but I have no idea, please help! Thanks in advance!  parent page : <html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form...

Default value for Dropdownlist that get's it's value from Database.
Hi, I am using an Object Data Souce to retrieve the value of a Dropdownlist from a table on MS SQL server 2005. I want to make a default value appear on the Dropdownlist intially, should i enter the default value into the database table or is that a better way of doing it? Any suggestions will be very much appreciated. E  No need for database just set sekected value after databingind protected void Page_Load(object sender, EventArgs e) { DataBind(); ListItem defaultItem = new ListItem("Select a Person", "-1"); th...

The value's length for key 'data source' exceeds it's limit of '128'.
Hii, When I tried to bind dropdownlist to database by declaring connection string in the code behind file I am getting this error: The value's length for key 'data source' exceeds it's limit of '128'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: The value's length for key 'data source' exceeds it's limit of '128'.Source Error: An...

new to .net, need help setting db values from checkbox's then retrieving value to a label control
Hi, Being new to asp.net i know this possible i just can't quite get it right!  I need a page with 5 checkbox's that when submitted sets the bit values in DB fields to checked. Then i need another page that retrieves the records of the checkboxes, but instead of having the db pre-set checkboxes on the second page i want it to turn on label web controls depending on if the check box is set.. I hope that makes sense?!! Can anyone point me in the right direction or to a suitable tutorial? Thanks in advance Ben Excellent article here.http://www.heliosfx.com...

need help getting value of textbox from 'RowEditing' event
hi,  i have a gridview whos 8th column is a template field. this field becomes editable when the user clicks on the 'edit' button in the gridview. i am trying to change the value of that field in the 'RowEditing' event. so far i have not been able to referrence that value of that textbox. i have searched these forums and none of the suggestions i have come across have worked for me. i keep getting a null value returned. the suggestions from msdn have also not worked for me (http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols....

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

How can I get out of my Mozilla's browser the Winamp browser and get back the Google's or Mozilla's browser.
Please I have got to my browser ( I don't know how.) the Winamp browser he behave like virus stick in.But he doesn't has uninstalation section so I can't do anything to get him away from Mozilla's file. I'm not happy of Winamp's behave its like advertisement against a customer's will. Please is there any way to get him away from Mozilla?Please send me exact direction I have tried many ways but he is deeply inside the systeme so when I install new Mozilla he is always here ready to pester me. Thank you for an answer. Richard ...

why a string column with a '' value synchronize from ASE to ASA, in ASA it's value become ' ' with a blank in it?
"darcy.zhai" <zhaizy@e-future.com.cn> wrote in news:43967064@forums-2-dub of sybase.public.sqlanywhere.mobilink: Please try to ask your question in the _body_ of the post, not the subject line. There are many people that never really look at the subject line (like myself most of the time). > why a string column with a '' value synchronize from ASE to ASA, in > ASA it's value become ' ' with a blank in it? This has to do with nullability. First, connect to ASE via ISQL and try the same query ML is executing. What is returned? An...

HELP!!! Control 'tbUsername' of type 'TextBox' must be placed inside a form tag with runat=server. What does this mean
hey i am not sure what the problem is but dont know what is wrong. this is the code and error message. in the html section i have this <asp:TextBox id="tbUsername" runat="server"></asp:TextBox> this is the code <script runat="server"> Sub Submit(Sender As Object, e As EventArgs) if Page.IsValid then Dim ObjUserDetails As New XTREMEDVD.UserDetails Dim ObjUser As New XTREMEDVD.User ObjUserDetails.Username = tbUsername.Text ObjUserDetails.Password = tbPassword.Text ...

cascading dropdown set it's value only once but not on subsequent postbacks,web service recieve the value but can't set in dropdown
i have a dropdown named uxcommunity which is a dropdown and contain text in format ##-####-#### . and 2 more dropdowns province and district where province filters district. i get the first 2 characters ##  for session("province") and #### for session("District") and i have button to do the postback. first when the form loads and i click the button it get the value and select appropraite items in to dropdown province and district. but when i change the province dropdown content and district dropdown content and click the button , session will take correct...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Think Tank Wants Public's Help in 'Spyware' Fight
By Brian Krebs, washingtonpost.com Staff Writer A Washington-based technology think tank wants Internet users to join its crusade against invasive "spyware" programs that let their authors eavesdrop on people's online activities. The Center for Democracy and Technology today urged Americans to submit details about their encounters with spyware, which often comes packaged as an unwanted addition to popular downloads like software for trading music files. The group said it will compile those experiences and submit them to the Federal Trade Commission (FTC) as part o...

Can't get away from: "Could not open in Design View. Quote values differently inside a '<% ... "value" ... %>' block."
I keep getting this error message when I try to switch to design view. This is the code that is causing it. OnClick="javascript:void(0);ToggleRowDisplay(this,'row<%# DataBinder.Eval(Container.DataItem, "Equipment_ID") %>');" When I take out this section I can go into design view without a problem. Any ideas?? is the word row has to be there?mess with the best...die like the rest...

Web resources about - Want to set TextBoxs' value that's inside FormView - Please Help - asp.net.getting-started

Resources last updated: 12/14/2015 8:49:44 AM