Forms Data Controls :: Textbox Returns Null

Aug 24, 2010

I have a gridview. In the rowupdating event, the txtbox returns null. I have enabled viewstate for the gridview. But still it does not work. I have made this in Kentico.

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1" EnableModelValidation="True"
OnRowUpdating="GridView1_RowUpdating" >
<Columns>
<asp:CommandField ShowDeleteButton="True" CausesValidation="false" ShowEditButton="True"
ControlStyle-Width="100px" />
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Name" SortExpression="name">
<ItemTemplate>
<asp:Label ID="lblRegionName" runat="Server" Text='<%# Bind("name") %>' Width="200px"></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="EditRegionName" OnTextChanged="EditRegionName_Updated"
Text='<%# Bind("name") %>' Width="200px" />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox runat="server" ID="InsertRegionName" Text='' Width="200px" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Archived" SortExpression="IsArchive">
<ItemTemplate>
<asp:CheckBox ID="lblArchive" Enabled="false" runat="Server" Checked='<%# DataBinder.Eval(Container.DataItem, "archived") %>'
Width="100px" />
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox runat="server" OnCheckedChanged="EditArchive_CheckedChanged" ID="EditArchive"
Width="100px" />
</EditItemTemplate>
<FooterTemplate>
<asp:CheckBox runat="server" ID="InsertArchive" Checked="false" Width="100px" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="btnHistory" runat="server" Text="History"></asp:LinkButton>
<ajaxToolkit:ModalPopupExtender OkControlID="OkButton" ID="ModalPopupExtender1" runat="server"
BackgroundCssClass="modalBackground" TargetControlID="btnHistory" PopupControlID="Panel1" />
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none">
<div>
<iframe frameborder="0" src="/CMSWebParts/MSM/RoundTableAfrica/Beheer/History.aspx?id=<%# DataBinder.Eval(Container.DataItem, "id") %>"
width="500px" height="100%" scrolling="no"></iframe>
<br />
<asp:Button ID="OkButton" runat="server" Text="OK" CausesValidation="false" Width="50" />
</asp:Panel>
</div>
</ItemTemplate>
<EditItemTemplate>
</EditItemTemplate>
<FooterTemplate>
<asp:Button ID="btnInsert" runat="server" Text="Insert" OnClick="Insert_Click" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
Region Name:<asp:TextBox runat="server" ID="NoDataRegionName" />
Archived:<asp:CheckBox runat="server" ID="NoDataIsArchive" />
<asp:Button runat="server" ID="NoDataInsert" CssClass="contentButton" Text="Insert"
OnClick="Button1_Click" />
</EmptyDataTemplate>
</asp:GridView>
<asp:Button runat="server" ID="Add" Text="Add" OnClick="Add_Click" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RTAConnectionString%>"
ProviderName="System.Data.SqlClient" SelectCommand="select * from [spiderwebs_region] order by name "
UpdateCommand="UpdateRegionWithHistory" UpdateCommandType="StoredProcedure"
DeleteCommand="DeleteRegionWithHistory" DeleteCommandType="StoredProcedure" OnInserting="Sqldatasource1_Inserting"
OnInserted="Sqldatasource1_Inserted" InsertCommand="InsertRegionWithHistory"
InsertCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="action_time" Type="DateTime" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="content_type_id" Type="Int32" />
<asp:Parameter Name="object_repr" Type="String" />
<asp:Parameter Name="action_flag" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
Code Behind:
protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataBind();
}
protected void GridView1_RowUpdating(Object sender, GridViewUpdateEventArgs e)
{
int index = e.RowIndex;
GridViewRow currentrow = ((GridView)sender).Rows[index];
TextBox txtbox = (TextBox)currentrow.FindControl("EditRegionName");
CheckBox isarchive = (CheckBox)currentrow.FindControl("EditArchive");
e.NewValues["name"] = txtbox.Text;
e.NewValues["archived"] = isarchive.Checked;
GridView1.EditIndex = -1;
GridView1.DataBind();
}

View 9 Replies


Similar Messages:

Forms Data Controls :: Why DataTable Always Returns Null

Oct 7, 2010

Since I am not using a DataSourceId at the markup I am having to create my own Sorting handler. I found a sample on MSDN but the variable 'dataTable' always returns null why?

[Code]....

and here is how I am feeding the DataGrid:

[Code]....

View 2 Replies

Forms Data Controls :: TreeView.FindNode Returns Null?

Dec 7, 2010

I have a treeView on my main page. While the page is postback the method TreeView.FindNode works fine. But when i return to main page from another, and loading ValuePath from session it returns null.

here is my treeView [Code]....

Code behind to save values in session on Page_Load:

[Code]....

Code behind to select TreeNode after return from other page on PageLoad

[Code]....

View 5 Replies

Forms Data Controls :: RowCommand Returns Null Value For Controls Which Are Not Binded To Gridview Source?

Oct 9, 2010

I am tryting to reach controls in the gridview rows by RowCommand event. I can take values of controls which are binded to gridview source successfully . But for all other controls which is not binded to gridview returns NULL value. All controls run at server. Why is that?

View 7 Replies

Data Controls :: Find Control Method In Details View Returns Null

Nov 29, 2013

I have detailsview control with bound fields...some usingĀ  Templatefields. I am trying to access values in those fields but i get nulls....i really dont know why..I am proving all my code....

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Projects.aspx.vb" Inherits="Projects" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Projects Statuses</title>

[code]....

I guess something might be getting messy with the mode changing event... a postback? But if i remove the databinding code, i get an error! why find control returns null??

View 1 Replies

Forms Data Controls :: GridView And Html Select - Find The GV Object (getElementByID("GridView1") Returns Null)?

Jul 10, 2010

I have a webpage with a select object and a GridView object. For testing my problem i've created asp button and html button.On pageLoad the GV is empty and select is being filled with names. (GV is not appearing)After choosing a name from the select options, the user should click a button and then the GV need to be filled with relevant info.I am having 2 "related" problems:

1. When clicking on the asp button and getting into the click function on the aspx.cs file, i can't find the select object and retrieve the selected option. How can i get this?

2. When clicking on the html button and getting into the button_click function on the aspx file (javascript), i can't find the GV object (getElementByID("GridView1") returns null). I guess that it's because the GV is not loaded initialy since it's empty.I've tried also using callback methods, but the although it seems like i am reaching the GV and performing DataBind(), the GV table won't show on the page.

View 4 Replies

Forms Data Controls :: How To Assign Null Value To The Textbox In Repeater

Jan 18, 2011

I am using repeater for binding data from the database

in repeater i put one textbox.

first time when page load event occured at that time value of textbox is null but when second time textbox takes previously assign values..

so how to assign null to the textbox.

View 4 Replies

Asp.net - FindControl For Nested Controls In UserControl Returns Null?

Aug 31, 2010

I have a UserControl that has some controls inside. I want to refer those controls after, in another postback. But when I try to get them the Controls property of my controls returns null. I'm working on vs2008.

Here is the sample code:

[code]....

View 2 Replies

Forms Data Controls :: Listview Toggle Visibility Of A Textbox Based On Data Not Null?

Sep 3, 2010

I want to toggle a Textbox to be visible (true, false) contained within an InsertItemTemplate based on the data being Null/Empty.

It Works in the Item Template since it is calling the "select parameters", but once it is in the "insert parameters" on databinds, I am unable to get this to work.

<%# String.IsNullOrEmpty(Convert.ToString(Eval("qu_8")))?Convert.ToBoolean("false"):Convert.ToBoolean("true") %>

(works in Item Templates, but not in InsertItemTemplate to toggle a textbox to be visible or not visible). I am using C# in code behind.

View 5 Replies

Forms Data Controls :: Handling A Null Value In Textbox FormView (on Button Click To Calculate Totals)

Mar 17, 2011

I have a rather large formview that asks for a variety of input values (physical totals vs pos report totals). I have created vb code to calculate the differences and subtotals of various types prior to inserting the data so people can check for entry errors.

Its a closing reconciliation form. Here's the problem: If they forget to enter 0 in a field that doesn't have any totals, a big ugly error message displays. I would like to avoid this. I can tell them until I am blue in the face to remember to enter 0 and not leave any blank fields, but realistically its going to happen and I need to handle it in the programming.

I have been struggling to either default the values to zero to start with, replace a null textbox with 0 before the calculate runs...but I can't get anything to really work. What is the best way to handle this?

Here is the aspx page:

[Code]....

And the code behind page with working "Calculate" as long as fields are not left blank (I took out all the test code that made it not work at all)

[Code]....

Finally, the error message I am getting is the following:

[Code]....

I can't seem to find the right combination of programming to account for the "" string to be 0 so that it will add or subtract values in my calculate. I have my sql table setup with default values of 0 so if a field is left blank it will be entered into the database as 0 and not null. It is really just for my inserting of a reconciliation and the running of Calculate Totals to double check their work prior to inserting into the database.

View 1 Replies

Web Forms :: Datalist Findcontrol Returns Null?

Mar 1, 2010

I have a datalist with price label

<asp:label runat="server" ID="lblPrice" Font-Bold="true" Font-Size="Medium"> <%# DataBinder.Eval(Container.DataItem, "dProduct_price") %></asp:label>

i have used to find the control in my code but when i debug the value is null

Label price = (Label)e.Item.FindControl("lblPrice");

View 1 Replies

Web Forms :: SiteMap.CurrentNode Returns Null For Internal SiteMapProvider?

Mar 7, 2010

I've run into an issue where calling SiteMap.CurrentNode returns null when it really shouldn't be. I'm using SiteMap.CurrentNode to highlight certain buttons on the page and generate a sub navigation bar (through SiteMap.CurrentNode.ChildNodes).

Now this works until I attempt to get to my pages of which are generated by a dynamic provider. For some reason whenever I attempt this on my Projects page SiteMap.CurrentNode returns null. Overall this is a bad situation for my program because then I cant generate my sub-navigation bar.

I was hoping someone here might be able to figure out the fault in my Sitemap or provider so that I can do a basic tutorial to others who are attempting the same thing since I haven't seen a tutorial that implements a provider in the manner that I have.

Web.SiteMap:

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Default.aspx" title="Home" description="Home page where updates and other information can be found">
<siteMapNode provider="ProjectProvider" />
<siteMapNode url="~/Contact/Default.aspx" title="Contacts" description="Contacts" />
</siteMapNode>.......

Provider:

Implements the following methods and all of them do not return Null (I checked via debug):
- RootNode
- GetRootNodeCore
- Initialize
- Clear
- BuildSiteMap

View 10 Replies

Web Forms :: FindControl Returns Null When Change Browser Language?

Jul 6, 2010

Like the title says, when I try to get a control (HiddenField) using this.Parent.FindControl it returns an exception. Curiosly this only happens when I change the browser language to Italian, English but not Spanish (I'm from Argentina so everything in my computer is spanish).

View 3 Replies

Web Forms :: BuildManager.GetType Returns Null Until Application Pool Recycles?

Mar 4, 2010

Our application uses the Enterprise Library's PropertyProxyValidator class to validate user input (v4.1 - Oct 2008). On occassion, the code will raise an exception saying the source type cannot be found. This error persists until the application pools recycle at night, at which point everything works again. It tends to only affect one of the web front ends at a time (there are two). I tracked down where the exception was being raised, and this is the section of code:

[Code]....

(As you can see, the value for this.SourceTypeName is shown in the exception and I've checked that it matches exactly.)

We have never been able to reproduce this exception and at this point don't have any ideas left as far as causes. For a while, my suspicion was that it was related to the Temporary ASP.NET Files folder. The last time the error occurred, I copied that folder from both web front ends. Then the next day when things were back to normal, I copied the folders. When I did a directory and file comparision of the affected web front end, I found no differences.

Our application is essentially user controls hosted in web parts on SharePoint (they don't do anything with SharePoint - in fact, for a while, we were developing the controls on ASPX pages). There are two servers in the farm, both with Windows Server 2003 R2 Standard x64, IIS 6, and .NET v3.5. This issue doesn't strike me as a problem with Enterprise Library or SharePoint, hence why I've posted here, but more so with assembly loading.

Any ideas for causes would be greatly appreciated. I could also use suggestions on tools I could use to try and debug this when happens again (it happens 2-3 times a month) in production.

View 11 Replies

Forms Data Controls :: Prevent Displaying " " On The Textbox Control If The GridView Columns Is Null?

Apr 7, 2010

How to prevent displaying this " " on the textbox control if the GridView columns is Null?

View 2 Replies

C# - SelectionList Always Returns NULL - How To Fix It

Jul 20, 2010

I have a very strange issue where SelectionList always returns NULL when i try check its Selected Item/Value. I Googled a bit and I found out that when i click the submit button, the page is being refreshed and the SelectionList is being data bound again so it will revert back to its original behavior.

Then i tried enclosing the binding code in the Page_Load event in a !IsPostBack but still when i try to access the Selected property it is null and an exception is thrown.

My code goes something like this... (the braces are not matched properly)

static SelectionList[] Symptoms;
static string UserID = "";

cmbSymptoms1,cmbSymptoms2,cmbSymptoms3 and cmbSymptoms4 are SelectionLists. I took them in to an array of SelectionList and then set the properties.

I had to make them static or else when i click the button to update, they will not retain their values.

protected void Page_Load(object sender, EventArgs e)
{
if (this.IsPostBack == false)
{
//System.Diagnostics.Debug.WriteLine("Not IsPostBack");
if (Request.QueryString["id"] != null && Request.QueryString.ToString() != "")
{
//System.Diagnostics.Debug.WriteLine("id query string is not null :- " + Request.QueryString["id"]);
myclass = new Class1();...........

View 1 Replies

Web Forms :: Dynamically Created Control Is Not Accessible / Dropdown Returns Null When Trying To Get The Values On Submitting The Form

Nov 17, 2010

Im dynamically creating several dropdowns onclick of a button... but the dropdown returns null when im trying to get the values on submitting the form... i read tat during postback all dynamically created controls will be lost... s there a way to register the controls... i want to access the item selected in the dropdown .... expecting a positive reply...

View 1 Replies

Mvc Json - Color Always Returns Null

May 22, 2010

I am working on a mvc project, and having problem with json. i have created a demo project with list of colors

public JsonResult GetResult()
{
List<string> strList = new List<string>();
strList.Add("white");
strList.Add("blue");
strList.Add("black");
strList.Add("red");
strList.Add("orange");
strList.Add("green");
return this.Json(strList);
}
i am able to get these on my page, but when i try to delete one color, that is when i send the following using jquery
function deleteItem(item) {
$.ajax({
type: "POST",
url: "/Home/Delete/white",
data: "{}",
contentType: "application/json; charset=utf-8",
success: ajaxCallSucceed,
dataType: "json",
failure: ajaxCallFailed
});
}

the controler action public JsonResult Delete(string Color) {} Color always returns null, even if i have specified "/Home/Delete/white" in the url. i know i am doing something wrong or missing something, but not able to find out what.

View 4 Replies

ADO.NET :: SP From Linq Returns Empty Or Null Value

Feb 15, 2011

I have a class library which has my LINQ doc in it. I added a stored procedure and I get the following in my .dbml.layout :

[Code]....

I include a reference to the dll of the class library to my web project and I get an error about value being returned as int where I am trying to put contents into a datalist or similar.

Code in class that calls this SP :

[Code]....

So I switched code to the following in my dbml.layout document :

[Function(Name="dbo.sp_newsSearch")]public IEnumerable<news_search_result> sp_newsSearch([Parameter(DbType="VarChar(200)")] string searchVal){IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), searchVal);return ((IEnumerable<news_search_result>)(result.ReturnValue));}

And included the following in an external file news_search_result.cs

[Code]....

But now I just get nothing returned. Is this wrong way of calling a SP via LINQ? or have I just put the wrong return type on my LINQ class?

View 2 Replies

AJAX :: Every Method Returns Null?

Feb 19, 2010

had used ajax.method in my project & its working fine, but now Every Ajax.Method returns null now,

View 1 Replies

Forms Data Controls :: Displaying A Null Or Empty Cell For A Null Datetime Database Value In Gridview?

Dec 6, 2010

I have setup my business object to have a create_date and edit_date members both datetime datatypes. My company want to display the create_date and edit_date fields in a gridview for each transaction. The problem i have is that after insterting a record it will have a valid create_date but no edit_date and when displayed in the gridview it defaults to datetime.minvalue (My default). How on earth do i show an empty field in my gridview for a null datetime field in the database?

I am using similar architecture to the Imar Spaanjaars example of a tiered solution. With a few small tweeks it has worked well for me for ages. I am passing a List<Database> to my object datasource which connects to my gridview.

View 3 Replies

DataTable.Rows.Find Returns Null

Feb 13, 2010

I have a DataTable for which a PrimaryKey constraint has been set to be a combination of an integer column and a datetime column. When I try to 'Find' a row by saying,

dtFunds.Rows.Find(iContainerIndex)

I get a null value. iContainerIndex has been defined as an object array of size 2 with the integer ID and date values in it.

When I set a breakpoint in my code, I see that the very same values are present in the datatable.

If I try to execute, DataTable.Select() method with the integer column filter, I get a result - but returns no result when called with the date column filter.

What am I doing wrong here? The very same DateTime value is present in the datatable.

View 1 Replies

C# - Telerik RadComboBox Find Returns Null?

Nov 1, 2010

why the below javascript code always returns null (mean alert) ?

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication3.WebForm1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<div>
<telerik:RadComboBox ID="RadComboBox1" runat="server">
</telerik:RadComboBox>
</div>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
var combo = $find("<%= RadComboBox1.ClientID %>");
alert(combo);
</script>
</telerik:RadCodeBlock>
</form>
</body>
</html>

View 2 Replies

ADO.NET :: Linq To SQL Returns Null For DateTime Fields?

Aug 17, 2010

I have a linq to sql entity class in which I declared some DateTime fileds like this:

[Code]....

And this is how I fetch data form repository:

[Code]....

All non DateTime fields are filled properly but all datetimes are null.[Column(DbType = "smalldatetime")]

View 8 Replies

AJAX $find Always Returns Null In Usercontrol?

Jul 30, 2010

I want to use multiple targets with my ModalPopUp extender. One of my buttons is set as target in the ModalPopup and the other one will use server-side code to show the ModalPopup.

This is my ModalPopup so far:

<msAjax:ModalPopupExtender ID="modalInform" runat="server"
BehaviorID="modalInform"
TargetControlID="btnSearchUsers" [code].....

Then I found this little tutorial on the ASP.NET AJAX site.But when I use $find("modalInform") in the pageLoad Javascript function (as defined in the tutorial at the bottom), I'm always getting a $find("modalInform") is null error.

This code is included in a usercontrol, the usercontrol is used in a ASPX page and this ASPX-page uses a MasterPage.
I've noticed that if I'm using

<%= modalInform.ClientID %>

I'm getting a different value then defined in my HTML-source (propably because of the MasterPage?).

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved