protected
override
void
OnLoad(EventArgs e)<br> {<br> RadGrid grid = (RadGrid)pc1.FindControl(
"dgSample"
);<br> RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, grid);<br> RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, Label2);<br>
base
.OnLoad(e);<br> }
protected
void
cTextbox_TextChanged(
object
sender, EventArgs e)<br> {<br> LiteralControl ctrl1 =
new
LiteralControl<br> (String.Format(
"<script type='text/javascript'>document.getElementById('{0}').innerHTML = '{1}';</script>"
,
this
.FindControl(
"Label2"
).ClientID,
"Teexx"
));<br><br><br>
//You should add the LiteralControl to the Controls collection of RadGrid in order to make it work with Telerik RadGrid AJAX<br> this.Controls.Add(ctrl1);<br> return;<br> }
Scenario:
I am developing an application using Telerik RadControls for ASPX.NET AJAX. I have tree
different Rad controls in the main page. A RadTreeview, a RadTabStrip and a RadGrid.
The basic functionality is: I select a node from the Treeview, that builds dynamic questions sourced from a database) in the RadTabStrip. And the answer to those questions is given by
selection an option in the single column RadGrid.
My questions are:
1. How can I set a default selection in the RadGrid?
2. When a node is selected the RadTabStrip is rebuilt but the page always blinks. How can I
avoid that blinking from the whole page running some server side code like the example here: http://demos.telerik.com/aspnet-classic/treeview/Examples/Programming/ServerSideApi/DefaultCS.aspx?
3. After a node selection and rebuilding the tabstrip pages, the RadTreeView loses the selected node focus. How can I keep the focus on the previously selected node? (it has something to do with that blink, can it be from the PostBack of the page?)
4. How can I load the grid having for each row a value and a text (value is an id related to the text element)?
Thank you all.
Regards
Bruno
private
void
ScheduleAppointment(
string
itemname,
string
vendor,
string
sortcode,
decimal
cost, DateTime start, DateTime end)
{
IDataSource dataSource = SchedulerDataSource;
DataSourceView view = dataSource.GetView(
"DefaultView"
);
IOrderedDictionary data =
new
OrderedDictionary();
data.Add(
"ItemName"
, itemname);
data.Add(
"Start"
, start);
data.Add(
"End"
, end);
data.Add(
"Vendor"
, vendor);
data.Add(
"SortCode"
, sortcode);
data.Add(
"Cost"
, cost);
//IDictionary keys = new OrderedDictionary();
//keys.Add("AppointmentID", id);
view.Insert(data, OnDataSourceOperationComplete);
}
<
asp:SqlDataSource
ID
=
"SchedulerDataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:Sitefinity %>"
SelectCommand="SELECT [inventory_id], [item_date], [deadline_date], [item_name], [sort_code], [vendor] FROM [inventory] WHERE ([item_date] IS NOT NULL) AND ([deadline_date] IS NOT NULL)"
InsertCommand="INSERT INTO [inventory] ([item_name], [item_date], [deadline_date], [vendor], [sort_code], [cost], [query_code], [committee_code]) VALUES (@ItemName, @Start, @End, @Vendor, @SortCode, @Cost, @Module, @Committee)"
UpdateCommand="UPDATE [inventory] SET [item_date] = @Start, [deadline_date] = @End, [item_name] = @Subject WHERE inventory_id = @AppointmentID"
DeleteCommand="DELETE FROM [inventory] WHERE [inventory_id] = @AppointmentID">
<
InsertParameters
>
<
asp:Parameter
Name
=
"ItemName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Start"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"End"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Vendor"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"SortCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Cost"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"Module"
Type
=
"String"
DefaultValue
=
"LUNCH"
/>
<
asp:Parameter
Name
=
"Committee"
Type
=
"String"
DefaultValue
=
"FOOD"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"ItemName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Start"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"End"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"AppointmentID"
Type
=
"Int32"
/>
</
UpdateParameters
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"AppointmentID"
Type
=
"Int32"
/>
</
DeleteParameters
>
</
asp:SqlDataSource
>
Thanks in advance!