Formatting gridview based on row data Part 9

  Рет қаралды 51,246

kudvenkat

kudvenkat

Күн бұрын

Пікірлер: 13
@marklesterechavez7228
@marklesterechavez7228 11 жыл бұрын
I sorted it out. sorry I was just a little bit frustrated that time. Thanks. By the way I used e.Row[col].cssclass. Thanks!
@marklesterechavez7228
@marklesterechavez7228 11 жыл бұрын
Hi Mr. Venkat, I was just wondering, how can I add the ItemStyle-CssClass programmatically because I'm not using sqldatasource where you can put it in the boundfield element. I've been trying to use rowdatabound event but I have no idea how to access it. I hope you get my point. Thanks. Love your videos as usual.
@niharikagurnani
@niharikagurnani 4 жыл бұрын
Hi Venkat, I tried this one, the salary is being read as "₹ 10,000.00" and a runtime exception is thrown "Input string was not in a correct format". I haven't added country culture as a column in my table, passing it as a string, still the culture is default. Sharing my code snippet here : if (e.Row.Cells[1].Text == "Niharika") { int salary = Convert.ToInt32(e.Row.Cells[3].Text); string countryCulture = "en-US"; string strFormattedSalary = string.Format (new System.Globalization.CultureInfo(countryCulture), "{0:c}", salary); e.Row.Cells[3].Text = strFormattedSalary; }
@sayslah
@sayslah 7 жыл бұрын
Just in case somebody wants to format the local time of a UTC datetime, I got it to work by using this code: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DateTime time = Convert.ToDateTime(e.Row.Cells[4].Text); TimeZoneInfo estZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); DateTime estTime = TimeZoneInfo.ConvertTimeFromUtc(time, estZone); string finalTime = estTime.ToString("h:mm tt"); e.Row.Cells[4].Text = finalTime; } } When you run the webform, my gridview displays the time as 2:33 PM for a UTC field that displayed prior to this code as 6:33 PM (I am eastern daylight savings as of today). I only show this because I had a helluva time trying to find any help about this time issue.
@jamet60
@jamet60 8 жыл бұрын
hello venkat, i wanna ask you somthing about culture, how can i find full list to change culture? i mean if india =en-IN then how about query for indonesia? thanks before
@madhukumar2050
@madhukumar2050 4 жыл бұрын
Using data key concept we can access visible=false data directly
@gwonmhz5285
@gwonmhz5285 11 жыл бұрын
Sir,I am getting the format exception in salary despite my code is exactly like yours.Salary is of type money in database. Help..
@Vishalsingh-ve8tu
@Vishalsingh-ve8tu 10 жыл бұрын
sir......i get the error in this line (e.Row.RowType = DataControlRowType.DataRow) type casting problem.....what is solution of this error please post it.....Thank!
@GrayMonk100
@GrayMonk100 11 жыл бұрын
I assume that Gridview is ASP only and not available in Windows forms. I looked around for it and did not find it.
@dharmitvyas8547
@dharmitvyas8547 10 жыл бұрын
Hi vishal singh , you have not added the double equal to operator "==" , your code must look like this if(e.Row.RowType == DataControlRowType.DataRow) { // do stuff }
@kavithavishwanathen6778
@kavithavishwanathen6778 7 жыл бұрын
thank u sir
@kushalkamboj2082
@kushalkamboj2082 10 жыл бұрын
thanks
@hprince20
@hprince20 11 жыл бұрын
yes iam also getting error like "input string is not in correct format" and the error is on this line " int AnnualSalary = Convert.ToInt32(e.Row.Cells[2].Text); " how to rectify this mr.venkat ..? need help
Design time and runtime formatting of gridview   Part 10
13:56
kudvenkat
Рет қаралды 46 М.
Formatting gridview using rowdatabound event   Part 8
16:06
kudvenkat
Рет қаралды 72 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
Object datasource in asp net   Part 3
9:32
kudvenkat
Рет қаралды 97 М.
Formatting asp net gridview control   Part 7
12:57
kudvenkat
Рет қаралды 94 М.
Part 61    How to get value from a gridview templatefield
17:31
kudvenkat
Рет қаралды 71 М.
Using stored procedures with objectdatasource control - Part 12
16:15
Repeater control in asp.net - Part 60
20:33
kudvenkat
Рет қаралды 107 М.
Turkish FM on post-Assad Syria: Strategy vs reality | Talk to Al Jazeera
27:41
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН