<
telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource">
<MasterTableView AutoGenerateColumns="false">
<Columns>
<telerik:GridBoundColumn DataField="ID" visible="true"></telerik:GridBoundColumn>
<telerik:GridDropDownColumn HeaderText="Document type" UniqueName="DocType" DataField="DocVal"
ListTextField="SubmitForm" ListValueField="DocVal" DropDownControlType="DropDownList"
EnableEmptyListItem="true" EmptyListItemText="---Choose an option--">
</telerik:GridDropDownColumn>
<telerik:GridTemplateColumn HeaderText="File to upload" UniqueName="TemplateColumn1">
<ItemTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Will Fax Later" UniqueName="TemplateColumn2">
<ItemTemplate>
<asp:CheckBox ID="FaxLater" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Status" UniqueName="TemplateColumn3">
<ItemTemplate>
<asp:Label ID="Status" runat="server" Text=" "></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
ds = GetSecondaryData()
Dim i As Integer
For i = 0 To FileCount - 1
arr.Add(FileCount)
Next
'Dim ddl As DropDownList
'ddl = RadGrid1.Items("TemplateColumn").FindControl("DDL1")
'ddl.DataSource = ds
'ddl.DataBind()
Dim table As DataTable = New DataTable()
table.Columns.Add(
"ID")
table.Columns.Add(
"SubmitForm")
table.Columns.Add(
"DocVal")
For i = 0 To arr.Count - 1
Dim row As DataRow = table.NewRow()
row(
"ID") = i
row(
"SubmitForm") = ds.Tables(0).Rows(i).Item(1)
row(
"DocVal") = ds.Tables(0).Rows(i).Item(0)
table.Rows.Add(row)
Next
RadGrid1.DataSource = table
RadGrid1.DataBind()
RadGrid1.Visible =
True
ds is a dataset populated with two columns, DocVal and SubmitForm.
arr is an Array.
I'm in kind of a bind here. I've been beating my head on the wall with this all day. Any help would be greatly appreciated.
| Sir I have a Page, say Page1.aspx.In it a radGrid and link button is placed When I click on the linkbutton, a radwindow with a usercontrol is loaded. ie, in Page1.aspx function OpenRadWindowCustomSearch() { var oWnd = radopen("Custom_Search_Page.aspx", "RadWindow2" ); oWnd.setSize(700,550) oWnd.center(); } Inside Custom_Search_Page.aspx ,I placed a usercontrol ie,in Custom_Search_Page.aspx < form id="form1" runat="server"> <div> <uc1:CustomSearch id="uclCustomSearch" runat="server" /> </div> </form> That usercontrol contains a buttonWhile clicking on tht button I want to rabind the grid in Page1 |
|
|
|
I tried with
top.$get("btnRebindGrid").click(); |
|
I m gettg the javascript error
Page1.aspxPage1.aspx.vb'top.$get(..)is null or not an object when i write it in code behind of usercontrol ie, Usercontrol.ascx.vb Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click Dim ds As New DataSet() ds = Custom_SearchBAL.GridDataSource Dim strFilterExp As String Dim i As Integer For i = 0 To ds.Tables(0).Rows.Count - 1 Custom_SearchBAL.SelectedFieldDatatype = ds.Tables(0).Rows(i)( "Datatype") strFilterExp = strFilterExp + ds.Tables(0).Rows(i)( "ANDOR") + ds.Tables(0).Rows(i)("FilterExp") Next Custom_SearchBAL.ResultantFilterExp = strFilterExp Dim strScript As String strScript = "<script language=javascript>" strScript += "top.$get('btnRebindGrid').click();" strScript += "<" strScript += "/script>" Page.RegisterStartupScript( "MSGE", strScript) Page1.aspx<asp:Button ID="btnRebindGrid" runat="server" Text="RebindGrid" style="display:none" /> Page1.aspx.vbProtected Sub btnRebindGrid_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRebindGrid.Click WorkDetailsGrid.Rebind() End Sub |
| Sub loaddpts() | |
| Dim dt As New Data.DataTable | |
| functions.FillDT(dt, ConnStrings.ConnectionStrings, "Select Distinct Department from leaders_employees where user_empid = '" & Session("EMPID") & "'") | |
| CCDropDown.DataTextField = "Department" | |
| CCDropDown.DataValueField = "Department" | |
| CCDropDown.DataSource = dt | |
| CCDropDown.DataBind() | |
| End Sub | |
| Sub fillJDCS(ByVal x As String) | |
| Dim dptds As New Data.DataTable | |
| Dim SQL As String = "Select Distinct sp_job_code,job_title from leaders_employees where department = '" & x & "' and user_empid = '" & Session("EMPID") & "'" | |
| functions.FillDT(dptds, ConnStrings.ConnectionStrings, SQL) | |
| JDCDD.DataSource = dptds | |
| ' JDCDD.DataValueField = "sp_job_code" | |
| JDCDD.DataTextField = "Job_title" | |
| JDCDD.DataBind() | |
| End Sub | |
| Protected Sub CCDropDown_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles CCDropDown.Load | |
| If Not IsPostBack Then | |
| loaddpts() | |
| End If | |
| End Sub | |
| Protected Sub CCDropDown_SelectedIndexChanged1(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles CCDropDown.SelectedIndexChanged | |
| fillJDCS(CCDropDown.SelectedValue) | |
| End Sub | |
| Protected Sub JDCDD_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles JDCDD.Load | |
| If Not IsPostBack Then | |
| fillJDCS(CCDropDown.SelectedValue) | |
| End If | |
| End Sub | |
| Protected Sub DD1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DD1.Load | |
| If Not IsPostBack Then | |
| Dim dt As New Data.DataTable | |
| functions.FillDT(dt, ConnStrings.ConnectionStrings, "Select Distinct Department from leaders_employees where user_empid = '" & Session("EMPID") & "'") | |
| DD1.DataSource = dt | |
| DD1.DataTextField = "department" | |
| DD1.DataValueField = "department" | |
| DD1.DataBind() | |
| End If | |
| End Sub | |
| Protected Sub DD2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DD2.Load | |
| If Not IsPostBack Then | |
| filldd2(DD1.SelectedValue) | |
| End If | |
| End Sub | |
| Protected Sub DD1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DD1.SelectedIndexChanged | |
| filldd2(DD1.SelectedValue) | |
| End Sub | |
| Sub filldd2(ByVal x As String) | |
| Dim dt As New Data.DataTable | |
| functions.FillDT(dt, ConnStrings.ConnectionStrings, "Select Distinct sp_job_code,job_title from leaders_employees where department = '" & x & "' and user_empid = '" & Session("EMPID") & "'") | |
| DD2.DataSource = dt | |
| DD2.DataTextField = "job_title" | |
| DD2.DataValueField = "sp_job_code" | |
| DD2.DataBind() | |
| End Sub |
I can't figure it out. I have AllowFilteringByColumn set to true on the main grid, so I thought it was supposed to allow it for all underlying tables, but everytime I attempt filtering a details table, I get a blank screen.
Here's the code:
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"
AllowPaging="True" AllowSorting="True" GridLines="None"
ondetailtabledatabind="RadGrid1_DetailTableDataBind"
onneeddatasource="RadGrid1_NeedDataSource" Skin="WebBlue">
<MasterTableView AutoGenerateColumns="false" DataKeyNames="ProjNo">
<DetailTables>
<telerik:GridTableView runat="server" ShowFooter="True">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
</telerik:GridTableView>
</DetailTables>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="ProjNo" DataType="System.Int32"
HeaderText="Project Number" ReadOnly="True" SortExpression="ProjNo"
UniqueName="ProjNo">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProjectName" HeaderText="Project Name"
SortExpression="ProjectName" UniqueName="ProjectName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DateCreated" DataType="System.DateTime"
HeaderText="Date Created" SortExpression="DateCreated"
UniqueName="DateCreated">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ProjectStatus" HeaderText="Project Status"
SortExpression="ProjectStatus" UniqueName="ProjectStatus">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="POCName" HeaderText="Point Of Contact"
ReadOnly="True" SortExpression="POCName" UniqueName="POCName">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
</ClientSettings>
<FilterMenu EnableTheming="True" Skin="Vista">
<CollapseAnimation Type="OutQuint" Duration="200">
</CollapseAnimation>
</FilterMenu>
</telerik:RadGrid>
CODE BEHIND:
private string user = "jrpuser";
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
GridData gd = new GridData();
RadGrid1.DataSource = gd.GetProjects(user);
}
protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
GridData gd = new GridData();
GridDataItem masterItem = (GridDataItem)e.DetailTableView.ParentItem;
e.DetailTableView.DataSource = gd.GetProjectDetails(user, Convert.ToInt16(masterItem.GetDataKeyValue("ProjNo")));
}
BUSINESS OBJECTS:
public DataTable GetProjects(string user)
{
SqlDataAdapter da = null;
DataTable table = new DataTable();
SqlConnection conn = null;
SqlCommand cmd = null;
string connection;
piiConnection strcon = new piiConnection();
try
{
connection = strcon.getConnection();
conn = new SqlConnection(connection);
cmd = new SqlCommand("spGetProjects", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@User", user));
da = new SqlDataAdapter(cmd);
conn.Open();
da.Fill(table);
}
finally
{
conn.Close();
}
return table;
}
public DataTable GetProjectDetails(string user, int id)
{
SqlDataAdapter da = null;
DataTable table = new DataTable();
SqlConnection conn = null;
SqlCommand cmd = null;
string connection;
piiConnection strcon = new piiConnection();
try
{
connection = strcon.getConnection();
conn = new SqlConnection(connection);
cmd = new SqlCommand("spGetProjectDetails", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@User", user));
cmd.Parameters.Add(new SqlParameter("@ProjNo", id));
da = new SqlDataAdapter(cmd);
conn.Open();
da.Fill(table);
}
finally
{
conn.Close();
}
return table;
}