hi leena, hope this code extract will be helpfull to you
function to convert the data into html string. private function convertDGToHTMLTable(dg:DataGrid):String { //Set default values var font:String =
dg.getStyle('fontFamily'); var size:String = dg.getStyle('fontSize'); var str:String = ''; var colors:String = ''; var style:String = 'style="font-family:'+font+';font-size:'+size+'pt;"';
var hcolor:Array; //Retrieve the headercolor if(dg.getStyle("headerColor") != undefined) { hcolor = [dg.getStyle("headerColor")]; } else {
hcolor = dg.getStyle("headerColors"); }
//Set the htmltabel based upon knowlegde from the datagrid str+= '<table border ="1" width="'+dg.width+'"><thead><tr width="'+dg.width+'" style="background-color:#' +Number((hcolor[0])).toString(16)+'">';
//Set the tableheader data (retrieves information from the datagrid header
//Loop through the records in the dataprovider and //insert the column information into the table
for(var j:int =0;j<dg.dataProvider.length;j++) { str+="<tr width=\""+Math.ceil(dg.width)+"\">";
for(var k:int=0; k <
dg.columns.length; k++) {
//Do we still have a valid item? if(dg.dataProvider.getItemAt(j) != undefined && dg.dataProvider.getItemAt
(j) != null) { str += "<td width=\""+Math.ceil(dg.columns[k].width)+"\" "+style+">"+dg.dataProvider.getItemAt(j)[
dg.columns[k].dataField]+"</td>"; } } str += "</tr>"; } str+="</tbody></table>";
return str; }
invoke the aspx page and pass the html table string as url variables:-
variables.htmltable = convertDGToHTMLTable(dgg1)//dgg1-datagrid var variables:URLVariables = new URLVariables();
public var urlExcelExport:String="http://localhost:2581/excelconvert/Default.aspx"; var u:URLRequest = new URLRequest(urlExcelExport);
u.data = variables; u.method = URLRequestMethod.POST; navigateToURL(u,"_blank");
there could be another approach as well where in instead of passing on the whole data as html string pass on only the params that result in this data and hit the db again using those params.
On Jan 14, 2008 2:23 PM, Leena Jain <leenajain82@...> wrote:
Well the link on Abdul's blog uses php to do the upload. But we are
not allowed to use php, Can u help me out with some ASP or ASPX example. Because we are allowed to use only ASP or ASPX . Any pointers would be very helpful.
Regards, Leena
On Jan 14, 12:22pm, Saravanan <
saras...@...> wrote: > HI Leena, > > Abdul has posted some tuts to export data in CSV from Datagrid >
> hope this will help u > > On Jan 14, 10:56 am, Leena Jain <leenajai...@...> wrote: > > > > > Hi all, > > > How can I save the data from Flex in a csv format using asp or aspx.I > > have a chart and a grid and I want to save thet data in the form of a
> > csv. > > > Thanks,
> > Leena Jain- Hide quoted text - > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_india@... To unsubscribe from this group, send email to flex_india-unsubscribe@... For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---