I have a button image in a radGrid. When the button image clicked I want to display a RadWindow. But before I display the RadWindow I need to populate a datagrid contained in the RadWindow.
Radwindow
I have tried using a static server button click handler where I populate the grid, but I can't get the RadWindow to display when I use the
Radwindow
<
telerik:RadWindow
runat
=
"server"
ID
=
"rwBulletins"
RestrictionZoneID
=
"ContentTemplateZone"
Modal
=
"true"
Width
=
700
Height
=
400
Skin
=
"Web20"
>
<
ContentTemplate
>
<
asp:panel
ID
=
"pnlBulletin"
runat
=
"server"
Width
=
700
BackColor
=
"White"
ForeColor
=
"Black"
BorderColor
=
Black
BorderWidth
=
5
>
<
table
>
<
tr
>
<
td
>s
<
b
><
asp:Label
ID
=
"Label10"
runat
=
"server"
Text
=
"Bulletins"
/></
b
>
<
hr
/>
</
td
>
</
tr
>
<
tr
><
td
align
=
"left"
>
<
asp:panel
ID
=
"pnlBulletinBody"
runat
=
"server"
ScrollBars
=
Vertical
Height
=
400
Width
=
700
>
<
table
>
<
tr
>
<
td
>
<
asp:DataGrid
ID
=
"dgBulletins"
runat
=
"server"
AutoGenerateColumns
=
"false"
>
<
AlternatingItemStyle
BackColor
=
"White"
/>
<
Columns
>
<
asp:BoundColumn
DataField
=
"Description"
HeaderText
=
"Description"
/>
<
asp:TemplateColumn
HeaderText
=
"Author/Date"
>
<
ItemTemplate
>
<%# Eval("Author") %><
br
/>
<%# Eval("CreationDate") %>
</
ItemTemplate
>
</
asp:TemplateColumn
>
</
Columns
>
</
asp:DataGrid
>
<
br
/><
br
/>
<
asp:Label
ID
=
"lbBulletinParent"
runat
=
"server"
/>
</
td
>
</
tr
>
</
table
>
</
asp:panel
>
</
td
>
</
tr
>
</
table
>
</
asp:panel
>
</
ContentTemplate
>
</
telerik:RadWindow
>
I have tried using a static server button click handler where I populate the grid, but I can't get the RadWindow to display when I use the
VisibleOnPageLoad property. (It does show if I cause another postback. Am I missing an autopostback property setting somewhere?)
Image Button in RadGrid
<
telerik:GridTemplateColumn
HeaderText
=
"Bulletins"
ItemStyle-HorizontalAlign
=
"Center"
>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"ibtnBulletin"
CommandName
=
"Bulletin"
runat
=
"server"
ImageUrl='<%#BulletinImage(Eval("ClientID")) %>'
Onclick="ibtnBulletin_Click" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Image Button Handler
Protected Sub ibtnBulletin_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Dim ibtn As ImageButton = CType(sender, ImageButton)
Dim dgi As Telerik.Web.UI.GridDataItem = ibtn.Parent.Parent
Dim ClientID As String = dgi.Cells(4).Text
dgBulletins.DataSource = clsBulletins.GetBulletinsByClientandReseller(ClientID)
dgBulletins.DataBind()
rwBulletins.VisibleOnPageLoad = True
End Sub
I also tried calling a javascript function from the image button to display the RadWindow which works in displaying the RadWindow, but I couldn't figure out how to call the routine to populate the grid from the javascript. So if that's a better approach I'm open to that. Here's how that call looked so far:
<
telerik:GridTemplateColumn
HeaderText
=
"Bulletins"
ItemStyle-HorizontalAlign
=
"Center"
>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"ibtnBulletin"
CommandName
=
"Bulletin"
runat
=
"server"
ImageUrl='<%#BulletinImage(Eval("ClientID")) %>'
OnClientClick="openWinContentTemplate(); return false;" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
And here's the javascript component:
<script type=
"text/javascript"
>
function
openWinContentTemplate() {
$find(
"<%=rwBulletins.ClientID %>"
).show();
}
</script>
Thanks for any help on this.