DataControlRowState is "Edit" or "Alternate, Edit"

In the Gridview RowDataBound event, I check for the state of the row to cast some controls and manipulate with them:

Protected Sub gvAutori_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) 

If e.Row.RowType = DataControlRowType.DataRow Then
            If e.Row.RowState = DataControlRowState.Normal Or e.Row.RowState = DataControlRowState.Alternate Then
             ...
            ElseIf e.Row.RowState = DataControlRowState.Edit Then
             ...
            End If
End Sub

Now I realize that the bold line is ignored if the row is in Edit mode in Alternate mode!

When I output the row mode, it says:
Alternate, Edit


So I replaced the bold line with this

ElseIf e.Row.RowState = DataControlRowState.Edit Or e.Row.RowState.ToString = "Alternate, Edit" Then

and it works.

 

Just wanted to share it with you, cause I saw somewhere similar post without solution (and I was wondering also), and I just can't find that post, so now when I found the solution I wanted to share.

Regards
Imbrod
 


I love spaghetti (both code and food)!
0
imbrod
9/13/2008 9:39:34 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
1401 Views

Similar Articles

[PageSpeed] 15

GreatBig Smile


Jai Ganesh. J , GSD ,India

Please Mark As Answer If my reply helped you.
0
Ganesh
9/13/2008 4:33:00 PM

Hi imbrod ,

Many persons ask this question, think you very much.

 



Samu Zhang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Samu
9/16/2008 3:57:31 AM
Reply:

Similar Artilces:

"Edit" Vs"Edit Mask"
Are there any potential problems changing a datawindow date field from "edit" to "edit style" and vice versa? I have over 100 datawindows and who knows how many of them have date fields. Question is if I change the edit style from "Edit" to "Edit Mask" of dd/mmm/yyyy. Will this cause any kind of problems? TIA Well we changed ours from editmask to edit (partly because of the large numbers of bugs in edit masks in early builds of PB7, partly because our customers found editmasks unfriendly to use) and it didn't cause any problems. ...

How do I set a home page. Traffic Swarm says just click "edit" then "preferences," but there is no "preferences," under "edit."
Name: Theodore Pong Email: theodorepongatyahoodotcom Product: Firefox Summary: How do I set a home page. Traffic Swarm says just click "edit" then "preferences," but there is no "preferences," under "edit." Comments: How do I set a home page. Traffic Swarm says just click "edit" then "preferences," but there is no "preferences," under "edit." Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16 From URL: http://hendrix.mozilla.org/ ...

.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. ...

Precedence of "where" ("of", "is", "will")?
Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } or: Str | (Int where { $_ }) ? Followup questions, Mr. President: What kind of operators are "where", "of", "is", and "will"? Is there a reason that S03 doesn't list them? What are their precedence(s)? -- Chip Salzenberg - a.k.a. - <chip@pobox.com> Open Source is not an excuse to write fun code then leave the actual work to others. Chip Salzenberg writes: &...

How to control editing fields "depends on" and "blocks"
Hi how can i do to restrict changes on fields "Depends on" and "blocks" to only users member of groups that control editing a product bugs. Thanks Fida On 29/03/10 18:43, fida wrote: > Hi > how can i do to restrict changes on fields "Depends on" and "blocks" > to only users member of groups that control editing a product bugs. Find the check_can_change_field in Bugzilla/Bug.pm and edit it according to the instructions within. Gerv ...

quotes, quotes, quotes...
I am getting this error and I know what is causing it, but I have no idea how to fix it, any help would be great. The script steps through the /var/log/messages file on a linux server and puts The entries into a mysql database. However when it gets to the 'hlt' line in the messages file it just barfs. The single quotes are freaking it out. I know about quotes but not how to use in this situation. Thanks, Paul Error: May 27 17:53:00 localhost kernel: Checking 'hlt' instruction... OK. <----- doesn't like this in the messages file DBD::mysql::st exec...

no "enable editing" "enable deleting" "enable updating"
In my visual studio 2005 beta1,there is no "enable editing", "enable deleting", "enable updating"options. why? is the vision wrong??thanks! Which control are you talking about?/Fredrik Normén - fredrikn @ twitterMicrosoft MVP, MCSD, MCAD, MCTASPInsidersMy Blog "gridview" control!! I have, so you should also have it if you create a data source for the GridView control in the design view and make sure you have specified the Insert and Update Command for the DataSource. You can also add a CommandField to the GridView columns <asp:CommandFi...

Change from Edit Style "Edit" till "DropDownDW" at runtime
Is it possible to change the edit style from "Edit" till "DropDownDW" at runtime? I want a DropDownDataWindow to appear when in query-mode only. How do I do it ? Thanks for any help! Turid Have you tried to use the Modify command? I didn't look up the syntax for this but it would be something like : dw_1.Modify("column_name.dddw.Name='d_list'") dw_1.Modify("colun_name.dddw.DataColumn='list_id'") You will need to GetChild() on "column_name" to retrieve the list but I'm sure you get the idea. HTH Turi...

"-" not "_"
I wrote a SQL statement in the data tab. I wrote a bunch of alaises as example ' word-type ' but when I hit the layout tab it converts the "-" to "_". So now my field name is ' word_type '. Is there any way to prevent this? CardGunner Don' use a hypen ( - ).  It isn't a valid character for column names.   See http://searchsqlserver.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid87_gci1188931,00.html   Here's an excerpt about column names: Letters as defined in the Unicode Standard 2.0 Decimal numbers from either B...

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

Replacing "\\" with "\"
Hi all I'm getting this value from a CheckBoxList control - a location of file, i have to remove "\\" and replace it with "\" and pass it to Query, how to do it, i tried with Replace, but coud'nt suceed. "\\\\Blaze10xp\\BLZ_SFS_07\\Sample Excel Files\\Excel Files\\report2.xls" thank's in advance - Prakash.C you tried Replace like this? string newstring = oldstring.Replace(@"\\",@"\");Plese, do not forget to click "Mark as Answer" on the post that helped you. Thanx!My blog: Scenes From A Developer Memory yes i tr...

double quote
hello there...  i tried everything of think but not working the way i wanted to be... not sure what i'm missing...i'm generating a <span> in code behind and then using in javascript.... here is what i'm doing code behind: int i=0string _keywordID = "keyword";string _name = row["visit_info_nm"].ToString().Trim(); String _getElementByID = String.Format("<span id='{0}' OnClick = \"document.getElementById('{1}').value='{2}';\">{3}</span><br>", i, _keywordID, _name, _name); here is what it generate : <span id='1' OnClick = \"document.getElementById('keyword')...

replace the "." with a ","
Oi.... I need to build a small programm in ASP.NET and chose to use C# for it.Now i got everything working but there's one little problem.the first textbox is a double. I need to make it so that when someone enters a "." then it gets replaced by a ","any ideas?Ghan  string blah = "4.2.2.2";blah = blah.Replace(".", ",");Ryan Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

"To" and "From" missing
When I print emails, the words "To" and "From" are blank, even though the "To" name and "From name (addresser, addressee) do show up. This is not a problem for other users on my system. Suggestions In mailbox right click, view. On the message window, right click and choose print options. Make sure print header is checked. -- Barry Merchant NSC Volunteer SysOp *** no email unless requested please!! *** > In mailbox right click, view. On the message window, right click and > choose print options. Make sure prin...

Web resources about - DataControlRowState is "Edit" or "Alternate, Edit" - asp.net.presentation-controls

Adding a Second Header to an ASP.NET Gridview
Last week, I had some specs to create a grid view in ASP that had normal column headers, as one might expect, and then also “super” column headers, ...

Resources last updated: 1/1/2016 5:32:20 PM