Changing the value of a "Hidden" column in a gridview VB.Net

Okay, now that I am able to get the values, I am havong an issue because part of my validation rule states that if a hidden column value comes back as null (which is okay) it goes to a functio to find the value that it should be populated with (even though it is still "invisible") this value must be passed back to the RPC (COBOL) program in order to run the update function.  So I have this bit of code to find the control (this works): 

If gdv_rcpt_srch.DataKeys(gdv_rcpt_srch.SelectedIndex).Values("CARR_MC_BUS_ID") <> "" Then
      ls_carr_mc_bus_id = gdv_rcpt_srch.DataKeys(gdv_rcpt_srch.SelectedIndex).Values("CARR_MC_BUS_ID")
End If
Now, later in the validation module I have some code that runs a function to verify this value and when it comes back it needs to set the value of that column (if it has changed) so I tried this code:  
gdv_rcpt_srch.DataKeys(gdv_rcpt_srch.SelectedIndex).Values("CARR_MC_BUS_ID") = ls_carr_mc_bus_id
This works just fine for a column value that is not hidden, but eve though I went and changed the ASP.Net to:  
<asp:TemplateField HeaderText="CARR_BUS_ID" Visible="False">
    <EditItemTemplate>
        <asp:TextBox ID="TextBox24" runat="server" Text='<%# Bind("CARR_MC_BUS_ID") %>' 
         ReadOnly="false"></asp:TextBox>
    </EditItemTemplate>
    <ItemTemplate>
	<asp:TextBox ID="TextBox24a" runat="server" Text='<%# Bind("CARR_MC_BUS_ID") %>' 
         ReadOnly="false"></asp:TextBox>
    </ItemTemplate>
</asp:TemplateField>
 I keep getting this error: "The OrderedDictionary is readonly and cannot be modified."

Can anyone please help me with this? TIA,

 


Coleen
"We Develop Webs"
0
Coleen
1/24/2008 8:12:33 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
873 Views

Similar Articles

[PageSpeed] 45

You can't modify the datakeys collection in your own code.  You'll need to find another method of storing the id and manipulating it. Have you tried using a hidden label or other control that you can find and edit the value of?

Colin

0
ColinWhitlatch
1/24/2008 8:17:29 PM

The problem is nothing can show - no part of the column can be visible.  If I use a hidden label, either the column header shows, or if I set the Width to 0 I get this weird looking band in the gridview.  If you have a suggestion on how to make a hidden laben in a column truly invisible, I'd love to hear how to do it...Thanks!

 


Coleen
"We Develop Webs"
0
Coleen
1/24/2008 8:59:25 PM

Well I take that back - turns out you can make a label cell "Hidden" - however, you can't make a label cell readOnly="True" I had to change it to a TextBox with the Visible property set to False and the ReadOnly set to true. I used this in my VB.net:  

ctype(gdv_rcpt_srch.Rows(i).FindControl("TextBox24a"), textBox).Text = ls_carr_mc_bus_id
and this in my ASP.Net  
<asp:TemplateField HeaderText="CARR_BUS_ID" Visible="False">
    <EditItemTemplate>
        <asp:TextBox ID="TextBox24" runat="server" Text='<%# Bind("CARR_MC_BUS_ID") %>' 
         ReadOnly="false"></asp:TextBox>
    </EditItemTemplate>
    <ItemTemplate>
	<asp:TextBox ID="TextBox24a" runat="server" Text='<%# Bind("CARR_MC_BUS_ID") %>' 
         ReadOnly="false"></asp:TextBox>
    </ItemTemplate>
</asp:TemplateField>

 And it worked (Also note that I DID remove the DataKeyNames value) - Thanks for your help.

 

 
Coleen
"We Develop Webs"
0
Coleen
1/24/2008 9:20:53 PM
Reply:

Similar Artilces:

Changing the "SelectedIndex" value of GridView Control
Hi, I am new to ASP and JavaScript development and have the following problem: I have been following the "3-Tier Architecture" tutorial series by Scott Mitchell on the ASP.net website. Under the section on "Enhancing the Gridview" (specifically tutorial #51), he explains how to add a column of radio buttons to the GridView control. He places a "Literal" control in a templated field, then changes the text of the Literal control to the following (during the _rowCreated sub of the GridView): String.Format("<input type=""radio"" ...

Bound GridView. Change column display from "P" to "Person"
I have an ASP.NET VS 2008 project that uses a bound GridView. (ASPX code is below)One of the columns displays the "Type" field, which is a single character "P", "S", "C", or "O".Instead of displaying the single character, I'd like to display "Primary", "Spouse", "Child", or "Other".I'm sure that this can be done with templates, but I can't figure it out.  Can someone help me set up the template to accomplish this?Thanks!  HBH' ********************* SQL Data source *************...

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD 9.0.0.580. Bruce "Bruce Lamb" <lamb.bruce@mayo.edu> wrote in message news:6HgI315nCHA.155@forums.sybase.com... > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

VB.NET ":=" ?
 Hi, what is this operator, ":=" ? I found it has something to do with "expression" , but not sure how to use it. I googled and didn't find any information.  Here you go: http://msdn.microsoft.com/en-us/library/51wfzyw0(VS.71).aspxThanks, EdMicrosoft MVP - ASP/ASP.NET...

.NET 2 "FileUpload" control (or html "file"-type input)
I want to change the button on the control to be a specific colour i.e. other than the default grey. However, I can't find an attribute for this. The background attribute changes the input box area colour. Is there a way to change the colour of the button? Thanks http://www.quirksmode.org/dom/inputfile.html   NC...  ...

programatically change "src" of an iframe in VB.NET
I'm using an iframe that is inset on a main application page, and I would like to have controls on the main page change the 'src' of the iframe programatically in the code behind. Does anyone have an example or website to send me to accomplish this? I'm having trouble referencing the iframe object in the code behind so that I can manipulate it's attributes... Thanks! Hello: <iframe ..... runat="server" Id ="iframe1" ..... /> public Page_load (..... ) { iframe1.Attributes.Add["src"] = "test1.aspx"; } regardsBi...

How can I access < input type="hidden" name="objHidden" id="objHidden" > from a .net server side function
Topic says it all..please help!! Right Click the control in the design view and select run as server control. ...

Calling A VB.NET Function in TextBox1.Attributes.Add("OnKeyUp", "search_log()")
Please tell me where i am wrong.  I am trying to call a vb.net function in attributes.add("OnKeyUp", "search_log()")   Function search_log() some codes here End Function   There is an error that "object expected"   Please Help JavaScript can not call a function that is serverside code. It can only call JavaScript code. If you want to call code on the server, you should ook into using the Ajax controls. Eric Pascarello.com | Twitter epascarello | LinkedIn Hi, I suggest you use pagemethod. For more infomation, see http...

ADO rs("col_name").value to ADO.NET dr.getValue(dr.getOrdinal("col_name")) question
In ADO under ASP we could access column values using: rs("col_name").valuewhich would allow us to treat fields rather generally, since VBScript doesn't have strong types (essentially the value was a string, a number, a date, or a null).Now in ADO.NET we need to get column values using: dr.getValue(dr.getOrdinal("col_name")) (or some other "get" method that knows the specific column type). The problem I am having in my conversion from ASP to ASP.NET, is that I have routines that display data from my client's Views and Stored Procedures. The client ca...

Change of "From" address with "Control-p"
Name: Dave Cartier Email: purchase4291ataoldotcom Product: Thunderbird Summary: Change of "From" address with "Control-p" Comments: Thunderbird "From" address switching problem The problem occurs when you do the following: · Launch a compose window · Touch the dropdown arrow of the "From" line (whether or not you select any other address. That is, you could touch the dropdown arrow and then touch it again to make it go back up without changing the "From" address and still have the problem described below.) Now...

"Null" value as "No Data" in Gridview
I have a TextBox in GridView which is filled with database value... whenever the value is "Null" I want the textbox as "No Data" How to do it??? thanks in advance If you are using SQL Server you can do it in your SELECT statement just use isnull(ColumnName,'No Data'). For example:  SELECT isnull(CoName,'No Data') CoName, isnull(CoAddress,'No Address') CoAddress FROM Company Where.... I do not have access to DB.... so I want to do it in gridview... how to do it ???  how u r binding the grid?Thanks and RegardsKrish-I have not fai...

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTg3MjQ" />
 Hi I am developig a website and when I try to see the page source in the explorer I have houndreds of lines about this:<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /><input type="hidden" name="__VIEWSTATEFIELDCOUNT" id="__VIEWSTATEFIELDCOUNT" value="697" /><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value=...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

need a "Date Modified: <date>" control for vb aspx.net 3.5
Sounds simple!  I just want a thing in my footer that says, "Date Modified: <date>" where <date> is the actual date the file was modified. I posted this question in the beginner's area but the suggested solutions do not work. I tried adding a Label control on my page, thus: <asp:Label ID="Label1" runat="server"></asp:Label>then in my masterpage.master.vb I have: Partial Class MasterPage    Inherits System.Web.UI.MasterPage    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System...

Web resources about - Changing the value of a "Hidden" column in a gridview VB.Net - asp.net.presentation-controls

Resources last updated: 11/20/2015 11:53:20 PM