<
telerik:RadGrid ID="Grid" runat="server" Skin="Outlook" GridLines="None" EnableAjaxSkinRendering="true">
<MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" EditMode="InPlace" DataKeyNames="ID" TableLayout="Fixed">
<CommandItemTemplate>
<asp:LinkButton ID="lnkBtnAddData" runat="server" CommandName="InitInsert" Visible="true"><img style="border:0px;vertical-align:middle;" alt="" src="../images/AddRecord.Gif" />
<asp:Literal ID="litAddData" runat="server" Text="Ajouter une donn‚e"></asp:Literal>
</asp:LinkButton>
</CommandItemTemplate>
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" CancelText="Annuler la modification de la donn‚e"
UniqueName="EditCommandColumn" CancelImageUrl="../RadControls/Grid/Skins/Outlook/Cancel.Gif"
FilterImageUrl="" InsertText="Ajouter une donn‚e" InsertImageUrl="../RadControls/Grid/Skins/Outlook/Update.Gif"
SortAscImageUrl="" SortDescImageUrl="" UpdateText="Mettre … jour la donn‚e"
UpdateImageUrl="../RadControls/Grid/Skins/Outlook/Update.Gif" EditText="Modifier la donn‚e"
EditImageUrl="../RadControls/Grid/Skins/Outlook/Edit.Gif">
<HeaderStyle Width="40px" />
<ItemStyle HorizontalAlign="Center" Width="40px"/>
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Supprimer la donn‚e" ConfirmText="D‚sirez-vous supprimer cette donn‚e ?" ConfirmDialogType="RadWindow"
UniqueName="DeleteColumn" ImageUrl="../RadControls/Grid/Skins/Outlook/Delete.Gif">
<HeaderStyle Width="20px" />
<ItemStyle HorizontalAlign="Center" />
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="ID" UniqueName="ID" Visible="false">
</telerik:GridBoundColumn>
</Columns>
<NoRecordsTemplate>
<asp:Label ID="lblNoRecordsTemplate" runat="server" Text="Aucun enregistrement"></asp:Label>
</NoRecordsTemplate>
<ItemStyle Font-Names="Tahoma" Font-Size="8pt" />
</MasterTableView>
</
telerik:RadGrid>
Dynamically I add many columns in my grid in load event of my page. I can click add data button but when i try to save my add, InsertCommand don't fired
why
I searched a little bit and didn't find much information. What I would like to do is an insert above or a below an item on the grid. About the only way I can think of doing it would be to have a table which counts the items and the order they're in. Then when you move them around it renumbers the rows in the table and does a refresh on the grid.
Then I'm pulling the information from the SQL database and putting it on a report with Telerik Reporting. So in the Report I could do just do a join and tell the SQL to order by ascending order.
Thanks,
Brett
function
ShowMARC()
{
try
{
grdDetail.AjaxRequest(
"<%= grdDetail.UniqueID %>", "YES");
}
catch(x)
{
alert(x);
}
}
protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string text)
{
base.RaisePostBackEvent(sourceControl, text);
bool showmarc = false;
if (SQL.ToString(text) == "")
showmarc =
SQL.ToBoolean(Session[WebConstant.Web_Global_ShowMARC]);
if (text == "YES")
showmarc =
true;
else if(text == "NO")
showmarc =
false;
int Itemid = SQL.ToInt(Session[WebConstant.Web_Global_ItemidForDetail]);
Session[
WebConstant.Web_Global_ShowMARC] = showmarc;
GridsDataBind(Itemid, showmarc);
}
protected void GridsDataBind(int intItemID, bool showmarc)
{
grdDetail.DataSource =
null;
grdDetail.Rebind();
grdDetail.DataSource = ShowMarc(showmarc);
grdDetail.Rebind();
string strSQLTmp = @" Select t03Identifier, t09LibraryName, t09NickName, t03Location,
t03CallNo as t03CallNo, t03CallNoNormalized, t03CopyBarcode, t03Status, t03DueDate,
Case When t03issueidentifier <= 0 Then t03Volume Else Case
When t72VolumeNo IS NOT NULL AND LTRIM(t72VolumeNo) <> '' Then 'Vol. ' + t72VolumeNo Else '' End +
ISNULL(' Iss. ' + t72IssueNo, '') + ' ' + CONVERT(nvarchar(10), t72MagazineDate, 20) End
As t03Volume, t03issueidentifier , t04FirstName + ' ' + t04LastName CheckoutBy From Copies_t03,libraries_t09,Issue_t72,Patrons_t04
Where t03CheckoutBy *= t04Key And t03IssueIdentifier *= t72Identifier And t09LibraryId = t03LibraryID and t03ItemIdentifier = "
+ intItemID;
string Libraries = "'" + (SQL.ToString(Session[WebConstant.Web_Global_LibraryID])).Replace(",", "','") + "'";
if ((Libraries.EndsWith("'0'")))
{
strSQLTmp = strSQLTmp +
" and t03LibraryID in (" + Libraries + ")";
}
strSQLTmp = strSQLTmp +
@"Order by
ISNULL(Replicate(' ',10-len(ISNULL(t72VolumeNo,''))),'') + ISNULL(t72VolumeNo,''), ISNULL(Replicate('
',10-len(ISNULL(t72IssueNo,''))),'') + ISNULL(t72IssueNo,''), t03Volume "
;
DataTable dt = SQL.ExecuteSQL_fill(strSQLTmp);
grdCopyInformation.DataSource =
null;
grdCopyInformation.Rebind();
grdCopyInformation.DataSource = dt;
grdCopyInformation.Rebind();
Session[
WebConstant.Web_Global_Iteminfomation] = dt;
string PatronKey = (string)Session[WebConstant.Web_Global_PatronKey];
string Sqlstr = @"Select t65ItemIdentifier, t65FileTitle as Title, t65FileType
as FileType, t65AttachFileName as Location, ISNULL(t65CoverImage,0)
t65CoverImage from ItemAttach_t65 where t65ItemIdentifier="
+ intItemID;
dt =
SQL.ExecuteSQL_fill(Sqlstr);
grdMultimedia.DataSource =
null;
grdMultimedia.Rebind();
grdMultimedia.DataSource = dt;
grdMultimedia.Rebind();
Session[
WebConstant.Web_Global_ItemMultimedia] = dt;
}
protected void radGrid_RowDrop(object sender, GridDragDropEventArgs e)
{
foreach(GridDataItem gridItem in this.radGrid.MasterTableView.Items)
{
//do stuff...
}
foreach (GridDataItem draggedItem in e.DraggedItems)
{
//do stuff
}
}
Edit - this grid is in a radajax panel if it makes any difference -
| For Each rowData In ds.Tables(0).Rows |
| cm = New CalendarioMedico() |
| cm.ID = rowData("IdeSeq") |
| Dim s As String = rowData("FECINI").ToString().Substring(0, 10) + " " + rowData("HORAINI").ToString() |
| cm.StartTime = DateTime.Parse(rowData("FECINI").ToString().Substring(0, 10) + " " + rowData("HORAINI").ToString()) |
| cm.EndTime = DateTime.Parse(rowData("FECFIN").ToString().Substring(0, 10) + " " + rowData("HORAFIN").ToString()) |
| cm.RecurrenceRule = rowData("RECURRENCERULE").ToString() |
| cm.CodPais = rowData("CODPAIS").ToString() |
| cm.CodCia = rowData("CODCIA").ToString() |
| cm.CodOfi = rowData("CODOFI").ToString() |
| cm.CodId = rowData("CODID").ToString() |
| cm.NumId = rowData("NUMID").ToString() |
| If rowData("INDTIPOHORARIO").ToString() = "01" Then |
| cm.TipoInfo = CalendarioMedico.TipoInfoCalendario.Especialidad |
| cm.Subject = rowData("NOMESPECIALIDAD").ToString() |
| cm.IdeEspecialidad = rowData("IDEESPECIALIDAD") |
| Else |
| cm.TipoInfo = CalendarioMedico.TipoInfoCalendario.NoDisponible |
| cm.Subject = "Feriado:" + rowData("DESMOTIVO").ToString() |
| cm.IdeEspecialidad = rowData("CODMOTIVO") |
| End If |
| lista.Add(cm) |