Hello,
I have two objects. Resource (Id, Quantity, AgencyId, Agency), and Agency (Id, Name)
I made a grid that represents resources, and i want the user to edit them using the batch edit mode.
For the AgencyId, i want the user to choose from a dropdownlist.
When the user hit save, i can get the value of the Quantity but the value of AgencyId is Empty.
Here is my html. im i missing some thing ??
<
telerik:RadGrid
ID
=
"AgenciesGrid"
runat
=
"server"
AutoGenerateColumns
=
"False"
Height
=
"280px"
>
<
ClientSettings
EnableAlternatingItems
=
"False"
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
<
MasterTableView
CommandItemDisplay
=
"Top"
HorizontalAlign
=
"NotSet"
EditMode
=
"Batch"
DataKeyNames
=
"Id"
ClientDataKeyNames
=
"Id"
SelectMethod
=
"GetAssociatedAgencies"
UpdateMethod
=
"UpdateAssociation"
InsertMethod
=
"InsertAssociation"
DeleteMethod
=
"DeleteAssociation"
>
<
Columns
>
<
telerik:GridTemplateColumn
HeaderText
=
"Agency"
UniqueName
=
"AgencyId"
DataField
=
"AgencyId"
>
<
ItemTemplate
>
<%# Eval("Agency.Name") %>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadDropDownList
runat
=
"server"
SelectMethod
=
"GetAgencies"
DataValueField
=
"Id"
DataTextField
=
"Name"
Width
=
"200"
/>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridNumericColumn
HeaderText
=
"Quantity"
DataField
=
"Quantity"
DecimalDigits
=
"0"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Hi,
We have a issue with scheduler in Ipad. If we select the moth view and try to create a appointment , it automatically navigates to day view. This issue is only in ipad in desktop version it works as expected. Can some one helps to resolve this issue. Thanks in advance!!.
Hi,
I have upgraded the Telerik version from 2014.1 to 2015.2. Now getting an error for Jquery. As I found there are two multiple solutions:
1) Disable the UnobtrusiveValidationMode
2) Add definition for JQuery in global.asax.
If I choose the first option, will it affect any new functionality I will get from 2015.2 ? Which one do you recommend ?
Regards
protected
override
void
SetupFilterControls(TableCell cell)
{
base
.SetupFilterControls(cell);
cell.Controls.RemoveAt(0);
var filterList =
new
RadComboBox();
filterList.Width = FilterControlWidth;
filterList.DropDownAutoWidth = RadComboBoxDropDownAutoWidth.Enabled;
filterList.AutoPostBack =
true
;
filterList.SelectedIndexChanged += filterList_SelectedIndexChanged;
filterList.Items.Add(
new
RadComboBoxItem(
""
,
""
));
// COMBO BOX IS POPULATED HERE -- CODE REMOVED
cell.Controls.AddAt(0, filterList);
}
protected
override
void
SetCurrentFilterValueToControl(TableCell cell)
{
base
.SetCurrentFilterValueToControl(cell);
if
(CurrentFilterValue !=
""
)
{
(cell.Controls[0]
as
RadComboBox).SelectedValue = CurrentFilterValue;
}
}
protected
override
string
GetCurrentFilterValueFromControl(TableCell cell)
{
return
(cell.Controls[0]
as
RadComboBox).SelectedValue;
}
private
void
filterList_SelectedIndexChanged(
object
sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
GridFilteringItem filterItem = (GridFilteringItem)((RadComboBox)sender).NamingContainer;
filterItem.FireCommandEvent(
"Filter"
,
new
Pair(
"EqualTo"
, UniqueName));
}
Hi, i have a problem.
I'm using a RadDropDownList in RadGrid when in Edit Mode. But i can't bind the datatable of list to the RadDropDownList.
here's my RadGridCode
<
telerik:RadGrid
ID
=
"radGridTarget"
GridLines
=
"None"
runat
=
"server"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
PageSize
=
"10"
Height
=
"250px"
Width
=
"500px"
OnItemDeleted
=
"radGridTarget_ItemDeleted"
OnItemInserted
=
"radGridTarget_ItemInserted"
OnItemUpdated
=
"radGridTarget_ItemUpdated"
AllowAutomaticUpdates
=
"True"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
onitemdatabound
=
"radGridTarget_ItemDataBound"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
HorizontalAlign
=
"NotSet"
EditMode
=
"InPlace"
AutoGenerateColumns
=
"False"
>
<
NoRecordsTemplate
>
<
table
width
=
"100%"
border
=
"0"
cellpadding
=
"20"
cellspacing
=
"20"
>
<
tr
>
<
td
align
=
"center"
>
<
h2
style
=
"color:Black"
>No Data</
h2
>
</
td
>
</
tr
>
</
table
>
</
NoRecordsTemplate
>
<
PagerStyle
Mode
=
"NumericPages"
/>
<
BatchEditingSettings
EditType
=
"Cell"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Sales"
HeaderText
=
"Sales"
Display
=
"false"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Target"
DefaultInsertValue
=
"Target"
HeaderStyle-Width
=
"150px"
UniqueName
=
"Target"
DataField
=
"Target"
>
<
ItemTemplate
>
<%# Eval("Target") %>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadDropDownList
runat
=
"server"
ID
=
"radDropDownTarget"
DataValueField
=
"Value"
DataTextField
=
"Target"
></
telerik:RadDropDownList
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridNumericColumn
DataField
=
"Amount"
HeaderStyle-Width
=
"80px"
HeaderText
=
"Target Amount"
SortExpression
=
"Amount"
UniqueName
=
"Amount"
>
</
telerik:GridNumericColumn
>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this target?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
HeaderText
=
"Delete"
HeaderStyle-Width
=
"50px"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"DeleteColumn"
>
</
telerik:GridButtonColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
AllowKeyboardNavigation
=
"true"
></
ClientSettings
>
</
telerik:RadGrid
>
and this is how i bind the RadDropDownList, and not working
protected
void
radGridTarget_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem editItem = (GridEditableItem)e.Item;
RadDropDownList dropDown = (RadDropDownList)editItem.FindControl(
"radDropDownTarget"
);
dropDown.DataSource = _presenter.PopulateTargetList();
dropDown.DataTextField =
"Value"
;
dropDown.DataValueField =
"Desc"
;
dropDown.DataBind();
}
}
Please help me. Thank you in advance
Dear Telerik Team,
I want to import data from different websites with HTML Agility Pack. Then I want to export data to my SQL database. I have little problem because every cell return my " " . I use method from this website:
http://www.telerik.com/forums/access-cell-values-in-radgrid-selected-index-event
So I think that problem is in import data.
I attach 2 sample code."Row" file return me correct data, but return me the same problem. I think that "Cell" sample code should return me correct data but in every rows display the same information.
Cell Code:
WebClient webClient = new WebClient();
StreamReader page = new StreamReader(WebRequest.Create("http://nolimits.art.pl/grafik/wyswietl.php?typ=2").GetResponse().GetResponseStream(), Encoding.UTF8);
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.Load(page);
HtmlNode node = doc.DocumentNode.SelectSingleNode("//table");
string context = node.InnerHtml;
DataTable NLTable = new DataTable();
//NLTable.Columns.Add(" ");//CheckBox
NLTable.Columns.Add("Dzien tygodnia");
NLTable.Columns.Add("Godziny zajec");
NLTable.Columns.Add("Nazwa zajec");
NLTable.Columns.Add("Poziom");
NLTable.Columns.Add("Instruktor");
NLTable.Columns.Add("Wolne miejsce dla");
foreach (HtmlNode row in node.SelectNodes("tr"))
{
if (row.InnerText != "" && row.InnerHtml.IndexOf("<th>") < 0 && row.InnerHtml.IndexOf("background-color") < 0)
{
TableRow tRow = new TableRow();
foreach (HtmlNode cell in row.SelectNodes("td"))
{
TableCell tCell = new TableCell();
tCell.Text = cell.InnerText;
tRow.Cells.Add(tCell);
}
NLTable.Rows.Add(tRow);
}
}
rgSynchronize.DataSource = NLTable;
rgSynchronize.DataBind();
}
Cell Sample code:
WebClient webClient = new WebClient();hello, I have a radgrid with a linkbutton column "Edit". I want to call a modalextenderpopup when a user clicks the Edit button using Javascript. But it is not working:
<
telerik:RadGrid
ID
=
"RadGrid_Search"
runat
=
"server"
AllowPaging
=
"True"
AllowSorting
=
"True"
GroupPanelPosition
=
"Top"
PageSize
=
"30"
ResolvedRenderMode
=
"Classic"
HorizontalAlign
=
"Right"
ondeletecommand
=
"RadGrid_Search_DeleteCommand"
onitemdatabound
=
"RadGrid_Search_ItemDataBound"
oneditcommand
=
"RadGrid_Search_EditCommand"
>
<
MasterTableView
Width
=
"100%"
DataKeyNames
=
"UPC"
>
<
EditFormSettings
>
<
PopUpSettings
Modal
=
"true"
/>
</
EditFormSettings
>
<
Columns
>
<
telerik:GridButtonColumn
UniqueName
=
"DeleteColumn"
Text
=
"Delete"
CommandName
=
"Delete"
ConfirmText
=
"AA"
></
telerik:GridButtonColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"EditColumn"
Text
=
"Edit"
CommandName
=
"Select"
></
telerik:GridButtonColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
HeaderStyle
Font-Bold
=
"True"
Font-Names
=
"Verdana"
/>
<
ItemStyle
Font-Names
=
"Verdana"
/>
</
telerik:RadGrid
>
<
cc1:ModalPopupExtender
ID
=
"popup"
BehaviorID
=
"popup1"
runat
=
"server"
DropShadow
=
"false"
PopupControlID
=
"pnlAddEdit"
TargetControlID
=
"lnkDummy"
BackgroundCssClass
=
"modalBackground"
OkControlID
=
"btnYes"
>
</
cc1:ModalPopupExtender
>
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = e.Item
as
GridDataItem;
string
contactName = dataItem[
"Album Name"
].Text;
LinkButton button = dataItem[
"DeleteColumn"
].Controls[0]
as
LinkButton;
button.Attributes[
"onclick"
] =
"return confirm('Are you sure you want to delete "
+
contactName +
"?')"
;
LinkButton btnEdit = dataItem[
"EditColumn"
].Controls[0]
as
LinkButton;
btnEdit.Attributes[
"onclick"
] =
"return ShowModalPopup()"
;
}
function
ShowModalPopup() {
try
{
$find(
"popup1"
).show();
}
catch
(err) {
alert(err.message);
}
return
false
;
}
I've searched and seen this several times before but I'm just stumped. I know i've got to be missing something simple.
Here's my scenario. I have 4 RadTextBoxes in a Panel along with a Search button and a Reset button. I have EmptyText values set for each of them. What I'd like is to have the Search button Disabled until someone enters at least one character into at least one of the TextBoxes (we allow partial matches). We had it working before sort of, until the EmptyText values were set. Like I said, I know i'm missing something stupid but here's the basic code:
Javascript:
function formValidation(oEvent) {
oEvent = oEvent || window.event;
var txtField = oEvent.target || oEvent.srcElement;
var ShouldEnabled = true;
if (document.getElementById("ctl00_Body_uxMemberFirstName").value.length == 0 || document.getElementById("ctl00_Body_uxMemberFirstName").value.length != 17)
{ ShouldEnable = false; }
if (document.getElementById("ctl00_Body_uxMemberLastName").value.length == 0 || document.getElementById("ctl00_Body_uxMemberLastName").value.length != 16)
{ ShouldEnable = false; }
if (document.getElementById("ctl00_Body_uxMemberId").value.length == 0 || document.getElementById("ctl00_Body_uxMemberId").value.length != 15)
{ ShouldEnable = false; }
if (document.getElementById("ctl00_Body_uxMemberId").value.length == 0 || document.getElementById("ctl00_Body_uxMemberId").value.length != 25)
{ ShouldEnable = false; }
if (ShouldEnabled) { document.getElementById("ctl00_Body_uxSearch_input").disabled = false; }
else { document.getElementById("ctl00_Body_uxSearch_input").disabled = true; }
}
---------------
window.onload = function () {
var txtMemberFirstName = document.getElementById("ctl00_Body_uxMemberFirstName");
var txtMemberLastName = document.getElementById("ctl00_Body_uxMemberLastName");
var txtMemberId = document.getElementById("ctl00_Body_uxMemberId");
var txtMemberOldId = document.getElementById("ctl00_Body_uxMemberId");
var ShouldEnabled = false;
document.getElementById("ctl00_Body_uxSearch_input").disabled = true;
txtMemberFirstName.onkeyup = formValidation;
txtMemberLastName.onkeyup = formValidation;
txtMemberId.onkeyup = formValidation;
txtMemberOldId.onkeyup = formValidation;
}
----------------------Then the code for the Telerik controls is:
<telerik:RadButton ID="uxSearch" runat="server" Text="Search" Width="55px" OnClick="uxSearch_Click"
ToolTip="Search" TabIndex="13" ValidationGroup="SearchMember" OnClientClicked="validateInput" />
I've set the uxSearch's Enabled property to False at Page load and on Pre-Render on a whim, set it inline in the code above, and everything else I can think of. I've tried it in multiple browsers and verified that the properties are set correctly via the debugger. I actually want to use similar behavior throughout the app with RibbonButtons but need to start here. We have code in the code behind that'll stop the search from happening if there aren't values in. I wasn't here for it but from what i understand, I 'broke' the code when I entered the EmptyText values for each of the relevant textbox controls which I believe was being handled with the validateinput method (not shown here b/c I don't think it's relevant).
Again, this has to be very common functionality and I'm not a UI guy (in fact my field is Data Science so doing UI stuff is way out of my league. No one else was able to get any traction though on any of the other items even though this one supposedly worked before so I was hoping to solve it here and use the same logic throughout. i beg your indulgence if this is such a newbie question and honestly, I did spend quite a while searching and trying things . I'm attaching the relevant files if that could help (although I'm certainly not asking anyone to debug my code). I just have a nagging suspicion I'm overlooking something really small and being new to Javascript I'm sure that's the case. Any help would be greatly appreciated.