Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
execute javascript in column (WebUltraGrid)
posted

Hello,

 I am having an extreme issue with the WebUltraGrid.

I am replacing the asp:GridView with the Ultra because I need edit in place.

I have this in an asp.GridView

 <asp:GridView ID="grdAttachments" SkinID="GridViewNormal" runat="server" DataKeyNames="Id" AutoGenerateColumns="false" OnRowDataBound="grdAttachment_RowDataBound" >

 

<Columns>

 

<asp:TemplateField> <ItemTemplate>

 

<asp:PlaceHolder ID="placeHolderDownloadAttachment" runat="server" />

 

 </ItemTemplate>

 

</asp:TemplateField>

 

</Columns>

 

</asp:GridView>

 

 Real easy and then I have a RowCreated event to create my picture link( Image wrapped in an anchor)

My injected code was:

protected void grdAttachment_RowDataBound(object sender, GridViewRowEventArgs e) {

 

 

if (e.Row.RowType == DataControlRowType.DataRow) {

 

 

PlaceHolder placeHolderDownloadAttachment = FindWebControl(e.Row.Controls, "placeHolderDownloadAttachment") as PlaceHolder ;

 

 

if (placeHolderDownloadAttachment != null) {

 

 

 

InspectionAttachmentReportAssociation assoc =e.Row.DataItem as InspectionAttachmentReportAssociation;

 

 

if (assoc != null) {

 

 

if(assoc.Attachment.Id != -1) {

 

 

HtmlAnchor anchor = new HtmlAnchor();

anchor.HRef =

 

"";

anchor.Attributes.Add("

 

onclick", "OpenWebPage('" + assoc.Attachment.Id.ToString() + "');");

 

 

Image imgDownload = new Image();

imgDownload.SkinID =

 

"DownloadImage";

 

 

 

 

 

 

 

 

anchor.Controls.Add(imgDownload);

placeHolderDownloadAttachment.Controls.Add(anchor);

}

 else

{

placeHolderDownloadAttachment.Visible =

false;

  }

}

Easy stuff so I tried to duplicate this in a webultragrid. The images shows, downloads..all if great until.

I test it! I have a multiview. View one as an asp user control displays data. View 2 had the ultragrid in it.

when click a hyperlink in view 1, it modifies the data, then sow2s view 2 that contains the webultragrid.

1st pass is fine. I hit my button that flips the view back and hides the grid. I click the label again. I get a failed to load viewstate error from the ultra grid. This works fine with the asp:gridview

I need viewstate. I gave up.

The I tried this:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<igtbl:UltraWebGrid ID="grdAttachments" runat="server" AllowUpdateDefault="Yes" OnInitializeRow="grdAttachments_InitializeRow" EnableViewState="true"

 

 

>

 

 

<Bands

>

 

 

<igtbl:UltraGridBand

>

 

 

<Columns

>

 

 

<igtbl:UltraGridColumn Key="Title" BaseColumnName="Title" DataType="String"

>

 

 

<Header Caption="Title"></Header

>

 

 

</igtbl:UltraGridColumn

>

 

 

<igtbl:UltraGridColumn Key="Description" BaseColumnName="Description" DataType

="String">

 

 

<Header Caption="Description"></Header

>

 

 

</igtbl:UltraGridColumn

>

 

 

<igtbl:UltraGridColumn Type="Button" CellButtonDisplay

="Always"

 

 

>

 

 

<CellButtonStyle CssClass="DownloadButtonImage" ></CellButtonStyle

>

 

 

 

</igtbl:UltraGridColumn

>

 

 

</Columns

>

 

 

</igtbl:UltraGridBand

>

 

 

</Bands

>

 

 

</igtbl:UltraWebGrid

>

 

 And the cell creates a button, but I need to execute javascript and inject the id from the aSPX.

Can anyone solve either one of these demos? Its urgent.

 Sorry for the horrible pasting but your editor hates me and keeps double and triple spacing my lines.

Thanks,

Nick