Re: Grid in email

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Siva M" <shiva_sm@xxxxxxxxxxxxxxxxx> wrote in message
news:e7k5bijDGHA.140@xxxxxxxxxxxxxxxxxxxxxxx
> Well, there is way to do it:
>
> System.Text.StringBuilder sb = new System.Text.StringBuilder();
> StringWriter sw = new StringWriter(sb);
> HtmlTextWriter htw = new HtmlTextWriter(sw);
> DataGrid.RenderControl(htw);

That sounds interesting.

Would I do this in my Page_load or PostBack after Binding the DataGrid?

I assume it would be something like:

dbReader = myDbObject.RunProcedure("GetEmployerFavorites", parameters)
<--Gets my data
SubmissionsGrid.DataSource = dbReader
SubmissionsGrid.DataBind()
<-- Bind the data to the datagrid

System.Text.StringBuilder sb = new System.Text.StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter htw = new HtmlTextWriter(sw);
DataGrid.RenderControl(htw);

I can now take SB and combine it with my email and send it to someone ?

Thanks,

Tom

> // Now, sb.ToString() will get you the HTML for the DataGrid.
>
> "tshad" <tfs@xxxxxxxxxxxxxx> wrote in message
> news:O2WQY5PDGHA.140@xxxxxxxxxxxxxxxxxxxxxxx
> So it has to be done by hand then.
>
> I was hoping there was someway to use a Datagrid or datalist to create the
> table and put the table into the body of the message.
>
> Thanks,
>
> Tom
> "Siva M" <shiva_sm@xxxxxxxxxxxxxxxxx> wrote in message
> news:eQ46j0IDGHA.740@xxxxxxxxxxxxxxxxxxxxxxx
>> Create the HTML markup for the table and use it as the body for the
>> email.
>> The email should have the body content type as HTML
>>
>> "tshad" <tfs@xxxxxxxxxxxxxx> wrote in message
>> news:OtPRVqHDGHA.2912@xxxxxxxxxxxxxxxxxxxxxxx
>> Is there a way to easily put a Datagrid in an email?
>>
>> I want to send a select result in the form of a Datagrid via an email to
>> some of our clients.
>>
>> Thanks,
>>
>> Tom
>>
>>
>>
>
>
>


.



Relevant Pages

  • Re: Grid in email
    ... HtmlTextWriter htw = new HtmlTextWriter; ... I was hoping there was someway to use a Datagrid or datalist to create the ... Tom ... > Create the HTML markup for the table and use it as the body for the email. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: export to excel
    ... An example using a datagrid is at: ... I've seen others that used HTML table instead. ... StringWriter stringWriter = new StringWriter; ... sqlserver is using utf-16 encoding for unicode character. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: OnItemDataBound Event aus anderer DLL nutzen...
    ... Du kannst die Rendermethode überschreiben und den vom Datagrid ... gerenderten HTML Quelltext dort modifizieren. ... > ich möchte mir ein eigenes DataGrid Control schreiben, ... > jeweilige Attribut gesetzt wird. ...
    (microsoft.public.de.german.entwickler.dotnet.asp)
  • Re: SQL Server BackEND Populates Datagrid with HTML Snipets
    ... Private Sub DGrid_ItemDataBound(sender As Object, ... > I have a SQL back end holding a bunch of html CODE snipits that I want> to populate in a datagrid using VB.net. ... Once of the values in the database is the following> string. ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: Datagrid and clientside callback events
    ... >> only a part of an HTML page like a datagrid and also came accross ... I believe that ICallBackEventHandler could be a solution. ... did you manage to update your datagrid by using ICallBackEventHandler? ... > control and you can add server side functionality too. ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)