|
You can get the calculated value while fetching the records itself from the database. Or also you can calculate that in OnItemDataBound event of the datagrid.
Best Regards,
Apurva Kaushal
|
|
|
|
|
If calculate in OnItemDataBound, how to write the code? I try this before but fail to get the data. Can you give me some sample code? Thanks..
Best Regards,
Pei Sun
|
|
|
|
|
here is the sample code which will help you:
public void dg_OnItemDataBound(object sender, DataGridItemEventArgs e)<br />
{<br />
if(e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)<br />
{<br />
DataRow drv = e.Item.DataItem;<br />
Label lbl = (Label)e.Item.FindControl("lblValue");<br />
lbl.Text = drv["Quantity"].ToString() * drv["Unit Price"].ToString();<br />
DropDownList dd = (DropDownList)e.Item.FindControl("ddl");<br />
string str = "javascript:return ValFunc(" + dd.ClientID.ToString() + ");";<br />
dd.Attributes.Add("onChange",str);<br />
<br />
<br />
}<br />
}
Here label control will be there in your datagrid as template column and will display the calculated value.
Also you have to take care about the casting.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks.. this sample will be helppful to me.. thanks a lot
Best Regards,
Pei Sun
|
|
|
|
|
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
Am developing a utility to read from a .resx file, edit the resource key contents, and then write it back to the .resx file.
Am able to change the file contents using ResxResourceReader() API and then changing the key and value, but am unable to write the tree back to the .resx file.
Any help would be of great help.
|
|
|
|
|
You basically use the ResxResourceReader class to read the resource, and should use the ResxResourceWriter class to edit the contents and overwrite the original file with this object.
|
|
|
|
|
How can i load image in .net 2005?
Scenario.
I have a web.config as:
- authorization with deny users="?"
-
|
|
|
|
|
I know nothing about web.config.
I am doing a web application. I stored my images in a folder which I created in the C:\... from the Solution Explorer window. I then added the existing item.
Finally from the toolbox standard, I added the image control and changed the image url.
Does this work?
i need a tutor
|
|
|
|
|
If the images are stored under the web root, then there will be no permissions issues. If the images are stored elsewhere on the hard drive, then by default, the ASPNET worker process does not have read/write permissions on any other folders.
The best practice would be to keep your images under the web root, particularly if they are just static images for display.
|
|
|
|
|
I guess that you are running your web site with the built-in web development server, if you run under the IIS, there should be no problem. The reason for that is that the built-in server services all the requests sent to it, it includes the dynamic web page like .aspx as well as the static files such as the images file. So to make it work with the built-in server, you simply group the image files in a folder, say Images , then you use the location tag to configure the authorization settings to allow all the users to access the Images folder.
|
|
|
|
|
Thanks a lot minhpc_bk,
But i want to ask you a question.
If i use the location tag to configure the authorization settings to allow all the users to access the my images folder.
It have any problem about security in my web site?
thanks
|
|
|
|
|
Well, this setting basically helps you overcome the built-in server issue, when you put your ASP.NET application in the live/production box, your web site normally runs with the IIS server instead of the built-in server. And this setting does not have any effect on the folder as the requests for the static files like the images are handled by the IIS, but the ASP.NET engine. I'm not sure which security you concern, but assuming you don't have any special setting for the images folder at the IIS level, all the users are basically able to access the Images folder with or without this setting in your web.config file.
|
|
|
|
|
Hi !
Myself developing an web application. My client needs that application should have language option means if he choose language option "French" then my application should display in "French"(all labels and data present on web page should change). I stuck here very badly ....plz help me ! If we can use any external tool or will it work after adding any dll then plz suggest !
Thanks
|
|
|
|
|
|
Thanks for reply man ! I have already used this technique but it is very tedious and we have 30-40 pages and its very difficult to handle.... so we want any external control which will help as to just add in reference and use it .
|
|
|
|
|
|
What man ! Why u r joking like this....there is no such site exist "http://www.magicWebsiteTranslatorToolForFree.com" ........plz help if u can , but dont do such stupid joke plz,
|
|
|
|
|
hi friends,
i am doing one Event Calendar. my requirement is i need put the event calendar in a user control. i made the all the things and in local,but if i put this in live server it is not working. it just simply displays the calendar, when change the month it is not chaning, and this is happening only in IE, it is working fine in Mozilla Firefox and opera browsers. no server side event is firing, can u help me please.
with regards
krisshnaprabhu
|
|
|
|
|
Hi friends,
I am Using ASP.Net 2.0 with c#. IN my application i am using gridview and MS-Access backend. While displaying date from db in gridview i mentioned
<asp:boundfield datafield="WorkedDate" headertext="Date" dataformatstring="{0 }" itemstyle-horizontalalign="Center">
It displays the date field as 7/1/2006 12:00:00 AM
but i need 7/1/2006 like this. Please Help Me.
Thanks & Regards
Prya
|
|
|
|
|
{0:MM/dd/yyyy}
Sam
|
|
|
|
|
This will be helpful.
http://www.codeproject.com/script/comments/forums.asp?msg=1585364&forumid=12076#xx1585364xx
Best Regards,
Apurva Kaushal
|
|
|
|
|
hi all,
im in a situation to get the sql exception in the UI that is Asp.net page.how can we catch sql exceptions from the asp.net page i.e through the code behind.
with regards,
susa
|
|
|
|
|
Ur question was not so clear. but then too with the given information u can handle sql exception by writing a try--catch block when u open a database connection;
Vipin
|
|
|
|
|
Hi all,
I have recently started working with .NET 2.0 and as I have heard, it is recommended to stop using tables for page layout. So I have constructed my page using DIVs as recommended. I have to say it's not very easy at first as you have to get a hold on how they work and how to place them, but then i found out they are quite nice.
The page displays great with IE but I'm having a problem when I open it with Firefox. The layout is a bit messed up, the centered elements are no longer centered and the image control (inside a DIV) has simply disappeared!
Is there a known problem with DIVs and Firefox? or maybe is it the CSS that I use? (all the styling, positioning and coloring is done in a CSS file)
Thanks in advance for your insights on that matter.
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|