Hi there,
A few months ago someone reported that when they exported their dg to
excel they got an error about a control needing runat=server. The
problem was that when you export to excel with most solutions you can
only have literal controls, so a checkbox would cause that error. That
person then just removed their checkbox.

My problem is I want to keep the checkbox, or at least replace any
checked boxes with an x. Can anyone help with that?

I used this online reference
(http://www.c-sharpcorner.com/Code/2003/Sept/Expor
tASPNetDataGridToExcel.asp)
to do my export, so I guess Ineed to do something in the ClearControls
function, I just don't understand it anough to know what. Can anyone
help?

Here is the function that I probably need to modify:
private void ClearControls(Control control)
        {
        for (int i=control.Controls.Count -1; i>=0; i--)
        {
                ClearControls(control.Controls[i]);
        }
        if (!(control is TableCell))
        {
        if (control.GetType().GetProperty("SelectedItem") != null)
        {
        LiteralControl literal = new LiteralControl();
        control.Parent.Controls.Add(literal);
        try
        {
        literal.Text =                         
(string)control.GetType().GetProperty("SelectedIte
m").GetValue(control,null);
        }
        catch

        {

        }

        control.Parent.Controls.Remove(control);
        }

        else

        if (control.GetType().GetProperty("Text") != null)
        {
        LiteralControl literal = new LiteralControl();
        control.Parent.Controls.Add(literal);
        literal.Text =
(string)control.GetType().GetProperty("Text").GetValue(control,null);
        control.Parent.Controls.Remove(control);
        }
        }
        return;
        }




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hti5buf/M=362335.6886445.7839731.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1124817694/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/";>In
 low income neighborhoods, 84% do not own computers. At Network for Good, help 
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to