about gridview - -new helphttp://forums.asp.net/t/1124168.aspx/1?about+gridview+new+helpMon, 27 Feb 2012 08:35:16 -050011241681763260http://forums.asp.net/p/1124168/1763260.aspx/1?about+gridview+new+helpabout gridview - -new help <p>&nbsp; </p> <p class="MsoNormal">At my GRIDVIEW I have 2 columns namely &quot;unit price&quot; and &quot;quantity&quot;.<br> I want to display the product of these 2 columns in another field called &quot;amount&quot; on the GRIDVIEW.<br> I wish to display the calculated value in this third column once the user lost focus from unit price or quantity.<br> I will appreciate urgent help...please.</p> 2007-06-20T10:26:09-04:001763392http://forums.asp.net/p/1124168/1763392.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p>Check the solution for a similar question at <a href="http://forums.asp.net/p/1100193/1670896.aspx#1670896"> http://forums.asp.net/p/1100193/1670896.aspx#1670896</a></p> <p>Thanks</p> 2007-06-20T12:14:26-04:001764172http://forums.asp.net/p/1124168/1764172.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p>&nbsp;Thanks... thanks a lot.....</p> <p>now i am at another problem. i want to save data to database from that gridview. can u help me by giving c# code? <br> </p> <p>&nbsp;<br> &nbsp;</p> 2007-06-20T18:04:21-04:001764493http://forums.asp.net/p/1124168/1764493.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p>&nbsp;patuary,</p> <p>&nbsp;If you want to save the data to a MS SQL DB, I would suggest using a simple stored procedure.&nbsp; Then what you can do is databind the gridview to the SP and there you have it.&nbsp; You can save the data with virtually no code other than the SP.</p> <p>If you have any ?'s on this, let us know</p> <p>&nbsp;thnx,</p> <p>Mark As Answer If this has helped you<br> &nbsp;</p> 2007-06-20T20:39:46-04:001764797http://forums.asp.net/p/1124168/1764797.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p>thanks... can u provide me C# code??</p> 2007-06-21T01:17:34-04:001765043http://forums.asp.net/p/1124168/1765043.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p>Check <strong><a class="" href="http://www.asp.net/learn/dataaccess/default.aspx?tabid=63">Data Tutorials</a></strong> of this site. </p> <p>Thanks</p> 2007-06-21T05:12:07-04:001765294http://forums.asp.net/p/1124168/1765294.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p>&nbsp;thanks a lot again.... now another problem. at page load event i bound salesAmount column by 0(Grid View)... </p> <p>when i want to save data to database the new calculated value(sales qty*price per qty) does not save... the default value doing save!!!!!&nbsp;</p> <p>&nbsp;</p> 2007-06-21T08:23:22-04:001769049http://forums.asp.net/p/1124168/1769049.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p></p> <blockquote><span class="icon-blockquote"></span> <h4>patuary</h4> .... now another problem. at page load event i bound salesAmount column by 0(Grid View)... </blockquote> <p></p> <p>You need to keep your page load event code to bound salesAmount column in an IsPostBack check</p> <p>void Page_Load(.....)<br> {<br> &nbsp;&nbsp;&nbsp; if ( ! Page.IsPostBack )<br> &nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // write your code here to bound the salesAmount<br> &nbsp;&nbsp;&nbsp; }<br> }</p> <p>When you try to save the new calculated values, on the insert/update command, the page_load will be called first and your values are getting reset. If you use the PostBack check, the code is executed only the first time and not on subsequent postback's</p> <p>Thanks</p> 2007-06-23T05:11:24-04:001769217http://forums.asp.net/p/1124168/1769217.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p>yes i did it.........&nbsp; BUT still remain same...<br> </p> <p>I cant understand what is the problem....... this problem is also to others 0 default valued fields...&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;&nbsp;&nbsp; string strSQL = &quot;&quot;, strCon = &quot;&quot;;<br> &nbsp;&nbsp;&nbsp; protected void Page_Load(object sender, EventArgs e)<br> &nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!Page.IsPostBack)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //GET CONNECTED<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strCon = ConfigurationManager.ConnectionStrings[&quot;DB_OrderConnectionString&quot;].ConnectionString;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlConnection con = new SqlConnection(strCon);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.Open();<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //GET SERVER DATE<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //this.lblEntryDate.Text = DateTime.Now.ToString(&quot;dd-MMM-yyyy&quot;);<br> &nbsp;&nbsp; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //GET PRODUCT INFO<br> </p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strSQL = &quot;SELECT intProductCode, strProductName as ProductName, SKU, Pack, intQtyPerCase AS QtyPerCase, mnyCasePrice,</p> <p><u><i><b>0 as QtyToDeliv, 0 as BonusQty, 0 as SalesAmnt, </b></i></u>intBonusQtyPerCase FROM&nbsp; tblProductInfo ORDER BY strProductName, intProductCode&quot;;</p> <p><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlCommand cmdP = new SqlCommand(strSQL, con);<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlDataAdapter AdapterP = new SqlDataAdapter(cmdP);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DataTable dtProduct = new DataTable();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AdapterP.Fill(dtProduct);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.GVChallanEntry.DataSource = dtProduct;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.GVChallanEntry.DataBind();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmdP.Cancel();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmdP.Dispose();<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //CLOSE CONNECTION<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.Close();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (Exception ex)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lblErr.Text = ex.Message;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (lblErr.Text == &quot;Line 1: Incorrect syntax near '='.&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Redirect(&quot;ChallanEntryScreen01.aspx&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lblErr.Text = ex.Message;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> <br> &nbsp;&nbsp;&nbsp; }<br> &nbsp;</p> 2007-06-23T12:43:07-04:002076321http://forums.asp.net/p/1124168/2076321.aspx/1?Re+about+gridview+new+helpRe: about gridview - -new help <p>i have solved this problem myself...&nbsp; thanks for help&nbsp;</p> 2007-12-25T09:54:28-05:004830142http://forums.asp.net/p/1124168/4830142.aspx/1?Calender+ControlCalender Control How could i make this code work for every year rather only for 2012......... holiday[&quot;1/1/2012&quot;] = &quot;New Year&quot;; holiday[&quot;1/5/2012&quot;] = &quot;Guru Govind Singh Jayanti&quot;; holiday[&quot;1/8/2012&quot;] = &quot;Muharam (Al Hijra)&quot;; holiday[&quot;1/14/2012&quot;] = &quot;Pongal&quot;; holiday[&quot;1/26/2012&quot;] = &quot;Republic Day&quot;; holiday[&quot;2/23/2012&quot;] = &quot;Maha Shivaratri&quot;; holiday[&quot;3/10/2012&quot;] = &quot;Milad un Nabi (Birthday of the Prophet&quot;; holiday[&quot;3/21/2012&quot;] = &quot;Holi&quot;; holiday[&quot;3/21/2012&quot;] = &quot;Telugu New Year&quot;; 2012-02-13T16:22:26-05:004830242http://forums.asp.net/p/1124168/4830242.aspx/1?Re+Calender+ControlRe: Calender Control If they all fall on the same day every year, then simply remove the year from the key and you can compare month/day alone. 2012-02-13T17:22:41-05:004830699http://forums.asp.net/p/1124168/4830699.aspx/1?Re+Calender+ControlRe: Calender Control Removed year from the key... tried changing this code lab.Text = (string)holidaylist[e.Day.Date.Month]; to lab.Text = (string)holidaylist[e.Day.Date.Month, e.Day.Date.Day]; but getting an error if (holidaylist[e.Day.Date.ToShortDateString()] != null) { Literal lit = new Literal(); lit.Text = &quot;&lt;br/&gt;&quot;; e.Cell.Controls.Add(lit); Label lab = new Label(); lab.Text = (string)holidaylist[e.Day.Date.Month]; Label1.Font.Size = new FontUnit(FontSize.Small); e.Cell.Controls.Add(lab); } 2012-02-14T03:29:37-05:004830790http://forums.asp.net/p/1124168/4830790.aspx/1?Re+Calender+ControlRe: Calender Control <p>Hi,</p> <p>check...</p> <p><a href="http://forums.asp.net/t/1627219.aspx/1">http://forums.asp.net/t/1627219.aspx/1</a></p> <p><a href="http://www.aspnet101.com/2008/11/holidays-with-the-calendar-control/">http://www.aspnet101.com/2008/11/holidays-with-the-calendar-control/</a></p> 2012-02-14T04:53:02-05:004830800http://forums.asp.net/p/1124168/4830800.aspx/1?Re+Calender+ControlRe: Calender Control <p>Hi,</p> <p>check the link for holiday calender..</p> <p><a href="http://www.c-sharpcorner.com/uploadfile/d5b8d2/how-to-add-holiday-details-within-calendar-control/">http://www.c-sharpcorner.com/uploadfile/d5b8d2/how-to-add-holiday-details-within-calendar-control/</a></p> <p><a href="http://www.codeproject.com/Articles/26704/Calendar-control-and-holidays">http://www.codeproject.com/Articles/26704/Calendar-control-and-holidays</a></p> <p></p> 2012-02-14T04:58:47-05:004831028http://forums.asp.net/p/1124168/4831028.aspx/1?Re+Calender+ControlRe: Calender Control Error::lab.Text = (string)holidaylist(e.Day.Date.Month, e.Day.Date.Day); 'Calender.holidaylist' is a 'field' but is used like a 'method' protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) { if (holidaylist[e.Day.Date.ToShortDateString()] != null) { Literal lit = new Literal(); lit.Text = &quot;&lt;br/&gt;&quot;; e.Cell.Controls.Add(lit); Label lab = new Label(); lab.Text = (string)holidaylist(e.Day.Date.Month, e.Day.Date.Day); Label1.Font.Size = new FontUnit(FontSize.Small); e.Cell.Controls.Add(lab); }} 2012-02-14T07:14:35-05:004831420http://forums.asp.net/p/1124168/4831420.aspx/1?Re+Calender+ControlRe: Calender Control <p>Hi,</p> <p>it may like..</p> <p><span>lab.Text = (string)holidaylist[e.Day.Date.Month, e.Day.Date.Day];</span></p> <p>[] instead of ()</p> <p>try it..</p> <p>Thanks...</p> <p><span><br> </span></p> 2012-02-14T10:54:56-05:004831939http://forums.asp.net/p/1124168/4831939.aspx/1?Re+Calender+ControlRe: Calender Control Error :No overload for method 'this' takes '2' arguments 2012-02-14T15:31:40-05:004844717http://forums.asp.net/p/1124168/4844717.aspx/1?Re+Calender+ControlRe: Calender Control This isn't working any alternatives? 2012-02-22T08:38:19-05:004848815http://forums.asp.net/p/1124168/4848815.aspx/1?Re+Calender+ControlRe: Calender Control <pre class="prettyprint">lab.Text = (string)holidaylist[e.Day.Date.Month, e.Day.Date.Day];</pre> <p>=&gt;&nbsp;</p> <pre class="prettyprint">lab.Text = (string)holidaylist[e.Day.Date.Month][e.Day.Date.Day];</pre> <p>&nbsp;</p> 2012-02-24T08:19:51-05:00