Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
283 views
Hi,
I have a grid where all the rows are in edit mode and a column with a total in the footer of the grid. I want to automatic display the sum of the column without postback when the user enter a value in a cell. The only solution to do this seems to be to sum the column in Javascript.  It is possible to do that ?  Is there a grid client API to do this?

Thanks
Yvan Sigouin
Sebastian
Telerik team
 answered on 30 Jul 2008
1 answer
187 views
Hi,

Our problem: 
Splitter not resized in its container when the container (e.g. TR) resized itself by other event

More Details:
-I have splitter inside user control.
-I have page with table. The user control with the splitter hosted in this page in specific TR.
- Other TR in this specific table has dynamic display TR.
- When the dynamically TR Hidden the splitter TR resized automatically. But the splitter stay with the same height (not fit the inside the container TR).

p.s.
-
I know the splitter has the Client API Resize method but I don’t want to use it (the splitter hosted in some user control and the table in page).
- I already try to work with DIV instead of table.

Code:
<table Height="99%" Width="98%" border="1">
<
tr>
<
td valign="top" >
<
telerik:RadSplitter ResizeWithParentPane="true" ResizeWithBrowserWindow="true"
Orientation="Horizontal" ID="splAll" LiveResize="false"
Skin="Gray" runat="server" Height="100%" Width="100%" >
<
telerik:RadPane ID="filterPane" runat="server" Height="30%" Width="100%">
AB
</
telerik:RadPane>
<
telerik:RadSplitBar ID="splbFilterAgainstTreeAndSearch" runat="server"
CollapseMode="Forward" EnableResize="true" />
<
telerik:RadPane Width="50%" Scrolling="None" ID="treeAndSearch" runat="server">
CD
</
telerik:RadPane>
</
telerik:RadSplitter>
</
td>
</
tr>
<
tr id="tr1" height="80px">
<
td onclick="trtochange.style.display='block';">click to show</td>
</
tr>
<
tr id="trtochange" height="80px">
<
td onclick="trtochange.style.display='none';"> click to hide</td>
</
tr>
</
table>

How can we solve the problem? May be you have behavior like ResizeWithBrowserWindow="true" meaning the splitter resized automatically when its container changed?

Thanks,
Olga
Sophy
Telerik team
 answered on 30 Jul 2008
1 answer
163 views
Hello, my application scenario is the following.

I have a rad grid with a select column which currently uses a button for selection.

What I would like to do is when the user clicks on the button, I would like a pop-up window, similar to that of a pop-up editor, but I do not want to edit the grid item, only show more details.

To show the details, I need to be able to bind a custom user control that I have created inside the popup to a data item from my database in a server-side event.

I have looked through the forms / documentation and cannot find a proper way to do this, do you have any suggestions?

As an alternative, I'd like to be able to dynamically bind the data item to a user control in a details template, I cannot find how to do this either.

Any help is greatly appreciated,
Thanx, T.J.


Veli
Telerik team
 answered on 30 Jul 2008
6 answers
307 views
Hi All...can any1 help...im using a radtreeview in a radcombobox...im bind data from sql to the treeview...my code:

       RadTreeView treeview = ((RadTreeView)Combobox2.FindControl("RadTreeView"));  
 
        foreach (DataRow dr in dtData.Rows)  
        {  
              
            RadTreeNode ParentLocationNode = new RadTreeNode();  
            ParentLocationNode.Text = (string)dr["Column"];  
            ParentLocationNode.Value = Convert.ToString(dr["Column"]);  
            treeview.Nodes.Add(ParentLocationNode);  
        } 
each time i get error: Object reference not set to an instance of an object.

plz help!
Wicus
Top achievements
Rank 1
 answered on 30 Jul 2008
1 answer
95 views
I downloaded the latest Q2 release of the RadControls for Asp.Net. Very frustrating to find all my skins have changed. I don't know if this is a bug or a very bad judgement call, but when people migrate to a new version I think you have certain expectations, and changing the appearance of existing skins is not one of them. My Office2007 theme tabs now have blue text instead of black. My Outlook calendar no longer has bolding for the days of the week and the spacing is completely different between rows. I'm thinking this has to be a bug, but it's forced me to reinstall the previous version. I hope you guys can look into this and warn people if you make these kind of changes. I don't like people changing the look of my app without asking me :).

Best,
Levi
Alex Gyoshev
Telerik team
 answered on 30 Jul 2008
3 answers
149 views
Hi,

I searching solution to read a textbox value from Page and use to set the path of ImageManager. I tried with javascripting and I'm be abble to read and sent the value in input hidden but not to retrieve in the codebehind. Object : create specific folders using the value added by user.

Reading the value from textBox

var

mytitle = document.getElementById("ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl00_Title").value;

var myauthor = document.getElementsByName("ctl00$ContentPlaceHolder1$contolPanel$ctl00$ctl00$editMetaFields$ctl00$Author")[0].value;

Passing to my input hidden

<

input id="myval1" type="hidden" runat="server" enableviewstate="true" />

document.getElementById("ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl00_editMetaFields_ctl00_Image2_myval1").value=mytitle;

document.getElementById(

"ctl00_ContentPlaceHolder1_contolPanel_ctl00_ctl00_editMetaFields_ctl00_Image2_myval2").value=myauthor;

Retrievin as Codebehind : NO WORKING
1/ Directly in Load_Page : No Value found
string folder1 = myval1.Value;
string folder2 = myval2.Value;
2/ No found
string folder1 = webBrowser1.Document.GetElementById("myval1").InnerText;
3/ If (!PostBack) No found
4/ Request Form Not accepted by my sol need web.config
string folder1 = Request.Form["myval1"];

It's possible to define the ImageManager path in javascripting to use my value ?.
Other solution to pass one value from TextBox in Page to ImageManager ?.
Nobody send value from javascript to codebehind?

Any help are welcome, Regards.


Tervel
Telerik team
 answered on 30 Jul 2008
1 answer
97 views
We have multiple publishing sites running on the same farm. One is for a client that is running the purchased version (5.) and one that is running the Lite version (4.). The problem is that the dlls for both versions are called the same thing and the ids used in the features to install are the same. Is there a way to run both versions in the same farm?
George
Telerik team
 answered on 30 Jul 2008
1 answer
81 views

Trying to apply filters in RadGrid for a column which has LinkButton. Filters are not showing on the Grid. Can you please let us know where I am making mistake. Below is the code to build columns. Please let me know if you have any other questions.

Thanks.




private

void BuildColumns()

{

GridBoundColumn clientNameBoundColumn1 = new GridBoundColumn();

RadTodoGrid.MasterTableView.Columns.Add(clientNameBoundColumn1);

clientNameBoundColumn1.DataField =

"ClientName";

clientNameBoundColumn1.HeaderText =

"Client Name";

clientNameBoundColumn1.UniqueName =

"Client Name";

// requestId.CommandName = "select";

 

GridBoundColumn folderIdColumn = new GridBoundColumn();

RadTodoGrid.MasterTableView.Columns.Add(folderIdColumn);

folderIdColumn.DataField =

"FolderId";

folderIdColumn.HeaderText =

"Folder Id";

folderIdColumn.UniqueName =

"FolderId";

folderIdColumn.Visible =

false;

GridBoundColumn procColumn = new GridBoundColumn();

RadTodoGrid.MasterTableView.Columns.Add(procColumn);

procColumn.DataField =

"ProcessName";

procColumn.HeaderText =

"Process Name";

procColumn.UniqueName =

"ProcessName";

procColumn.Visible =

false;

 

 

GridBoundColumn engName = new GridBoundColumn();

RadTodoGrid.MasterTableView.Columns.Add(engName);

engName.DataField =

"Engagement";

engName.HeaderText =

"Engagement";

engName.UniqueName =

"Engagement";

 

GridButtonColumn actionMessage = new GridButtonColumn();

RadTodoGrid.MasterTableView.Columns.Add(actionMessage);

actionMessage.ButtonType =

GridButtonColumnType.LinkButton;

actionMessage.AutoPostBackOnFilter =

false;

actionMessage.CommandName =

"Select";

actionMessage.DataTextField =

"ActionMessage";

actionMessage.HeaderText =

"Message";

actionMessage.UniqueName =

"ActionMessage";

}

Shinu
Top achievements
Rank 2
 answered on 30 Jul 2008
7 answers
519 views
Hi,

I created a Rad Grid dynamically in the VB code behind.  Following the procedures in programmatic creation of RadGrid.  There are TextBox control in the GridTemplateColumn.  I also defined a GridTemplate class with the InstantiateIn method in it.  I added the event handler for TextChanged event.  I also set the EnableAjax flag of the RadGrid and the AutoPostBack flag of the TextBox to be true.  The update of the TextBox works totally fine with the ajaxified feature.

I tried to do a view source after the page is loaded and the TextBox is defined like this:
<input name="_ctl0:ContentPlaceHolder1:_ctl11:_ctl1:_ctl4:txt" type="text" value="90.00" onchange="javascript:setTimeout('RadGridNamespace.AsyncRequest(\'_ctl0$ContentPlaceHolder1$_ctl11$_ctl1$_ctl4$txt\',\'\', \'_ctl0_ContentPlaceHolder1__ctl11\', event)', 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" language="javascript" id="_ctl0_ContentPlaceHolder1__ctl11__ctl1__ctl4_txt" style="width:70px;text-align:right;" />

Now, my question is, how can I add a javascript function in the "onchange" event of the TextBox?  My goal is to use that javascript function to validate the text in the TextBox first, if everything is correct, then move to the TextBox.TextChanged event in the code behind. Is it possible to do something like this after the page is loaded?

<input name="_ctl0:ContentPlaceHolder1:_ctl11:_ctl1:_ctl4:txt" type="text" value="90.00" onchange="javascript:if validateTextBox() then {setTimeout('RadGridNamespace.AsyncRequest(\'_ctl0$ContentPlaceHolder1$_ctl11$_ctl1$_ctl4$txt\',\'\', \'_ctl0_ContentPlaceHolder1__ctl11\', event)', 0)}" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" language="javascript" id="_ctl0_ContentPlaceHolder1__ctl11__ctl1__ctl4_txt" style="width:70px;text-align:right;" />
Iana Tsolova
Telerik team
 answered on 30 Jul 2008
2 answers
367 views
I have been using radcontrols for a while now but haven't had this problem before.  All I am trying to do is access a checkbox list that is bound to a list table in the database in the edit forms template, cycle through and check the boxes based on a datareader from another lookup table.  I have tried accessing the checkboxlist control in every event I can think of but keep getting a null reference error.  I am stumpped.  My code is as follows:

<

asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<

div id="divMsgs" runat="server" style="float: left;">

<asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>

<asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>

<

br />

</

div>

<

telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"

AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowSorting="True"

DataSourceID="SDS_UserInfo" GridLines="None" ShowFooter="True" Skin="Hay"

AutoGenerateColumns="False" ShowStatusBar="True" OnItemDeleted="RadGrid1_ItemDeleted"

OnItemInserted="RadGrid1_ItemInserted" OnItemUpdated="RadGrid1_ItemUpdated"

OnItemCommand="RadGrid1_ItemCommand" OnPreRender="RadGrid1_PreRender"

DataMember="DefaultView" AllowPaging="True" ShowGroupPanel="True">

<

MasterTableView DataKeyNames="UserID" DataSourceID="SDS_UserInfo"

CommandItemDisplay

="TopAndBottom"

datamember="DefaultView" AllowPaging="False" EditFormSettings-EditColumn-Display="True"

AllowAutomaticDeletes="True" AllowAutomaticInserts="True"

AllowAutomaticUpdates="True" EditFormSettings-EditColumn-ButtonType="LinkButton"

runat="server" GroupsDefaultExpanded="False">

<

RowIndicatorColumn>

<

HeaderStyle Width="20px"></HeaderStyle>

</

RowIndicatorColumn>

<

ExpandCollapseColumn>

<

HeaderStyle Width="20px"></HeaderStyle>

</

ExpandCollapseColumn>

<Columns>

<telerik:GridEditCommandColumn>

</telerik:GridEditCommandColumn>

<telerik:GridButtonColumn CommandName="Delete" Text="Delete"

UniqueName="Delete">

</telerik:GridButtonColumn>

<telerik:GridBoundColumn DataField="UserID" DataType="System.Int32"

HeaderText="UserID" ReadOnly="True" SortExpression="UserID" UniqueName="UserID">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="UserName" HeaderText="UserName"

SortExpression="UserName" UniqueName="UserName">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Password" HeaderText="Password"

SortExpression="Password" UniqueName="Password">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Name" HeaderText="Name"

SortExpression="Name" UniqueName="Name">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="AccessLevel" HeaderText="AccessLevel"

SortExpression="AccessLevel" UniqueName="AccessLevel">

</telerik:GridBoundColumn>

<%

--<telerik:GridTemplateColumn DataField="AccessLevel" DataType="System.Int32"

HeaderText="AccessLevel" SortExpression="AccessLevel" UniqueName="AccessLevel">

<EditItemTemplate>

<asp:CheckBoxList ID="CHKList_AccessLevel" runat="server"

DataSourceID="SDS_AccessLevel" DataTextField="AccessLevelName"

DataValueField="AccessLevelCode"

RepeatColumns="2" >

</asp:CheckBoxList>

</EditItemTemplate>

<ItemTemplate>

<asp:Label ID="LBL_AccessLevel" runat="server"

Text='<%# Bind("AccessLevel") %>'></asp:Label>

</ItemTemplate>

</telerik:GridTemplateColumn>--

%>

<telerik:GridBoundColumn DataField="DSN" HeaderText="DSN" SortExpression="DSN"

UniqueName="DSN">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="COM" HeaderText="COM" SortExpression="COM"

UniqueName="COM">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Fax" HeaderText="Fax" SortExpression="Fax"

UniqueName="Fax">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Email" HeaderText="Email"

SortExpression="Email" UniqueName="Email">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="TechArea" HeaderText="TechArea"

SortExpression="TechArea" UniqueName="TechArea">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="ServiceID" DataType="System.Int32"

HeaderText="ServiceID" SortExpression="ServiceID" UniqueName="ServiceID">

</telerik:GridBoundColumn>

<telerik:GridCheckBoxColumn DataField="nondisc" DataType="System.Int32"

HeaderText="nondisc" SortExpression="nondisc" UniqueName="nondisc">

</telerik:GridCheckBoxColumn >

<telerik:GridBoundColumn DataField="disclosure_signed"

DataType="System.DateTime" HeaderText="disclosure_signed"

SortExpression="disclosure_signed" UniqueName="disclosure_signed">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Service" HeaderText="Service"

SortExpression="Service" UniqueName="Service">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="AccessLevelName"

HeaderText="AccessLevelName" SortExpression="AccessLevelName"

UniqueName="AccessLevelName">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Organization" HeaderText="Organization"

SortExpression="Organization" UniqueName="Organization">

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="OrganizationID" DataType="System.Int32"

HeaderText="OrganizationID" SortExpression="OrganizationID"

UniqueName="OrganizationID">

</telerik:GridBoundColumn>

</Columns>

<

EditFormSettings EditFormType="Template">

<

EditColumn UniqueName="EditCommandColumn1" ButtonType="ImageButton"></EditColumn>

<FormTemplate>

<table id="Table2" cellspacing="2" cellpadding="1" width="500" border="0" rules="none"

style="border-collapse: collapse;background:white;">

<tr>

<td colspan="1" style="font-size: small" class="style3">

<asp:Label ID="Label3" runat="server" Font-Bold="True" Font-Size="Medium"

Text="User Info." Width="100px"></asp:Label>

</td>

<td class="style5" style="font-size: small">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</td>

<td class="style4" style="font-size: small">

&nbsp;</td>

</tr>

<tr>

<td class="style3">

<table ID="Table4" border="0" cellpadding="1" cellspacing="1">

<tr>

<td>

UserID:

</td>

<td>

<asp:Label ID="Label5" Text='<%# Bind("UserID") %>' runat="server" Width="200px"></asp:Label>

</td>

</tr>

<tr>

<td>

UserName:

</td>

<td>

<telerik:RadTextBox ID="RadTextBox16" Runat="server" InvalidStyleDuration="100"

Text='<%# Bind("UserName") %>' Width="200px" Skin="Hay">

</telerik:RadTextBox>

</td>

</tr>

<tr>

<td>

Password:

</td>

<td>

<telerik:RadTextBox ID="RadTextBox17" Runat="server" InvalidStyleDuration="100"

Text='<%# Bind("Password") %>' Width="200px" Skin="Hay">

</telerik:RadTextBox>

</td>

</tr>

<tr>

<td>

Name:

</td>

<td>

<telerik:RadTextBox ID="RadTextBox18" Runat="server" InvalidStyleDuration="100"

Text='<%# Bind("Name") %>' Width="200px" Skin="Hay">

</telerik:RadTextBox>

</td>

</tr>

<tr>

<td>

DSN:

</td>

<td>

<telerik:RadMaskedTextBox ID="RadMaskedTextBox" Runat="server" InvalidStyleDuration="100"

Text='<%# Bind("DSN") %>' Width="200px" DisplayMask="###-####"

Mask="###-####" Skin="Hay">

</telerik:RadMaskedTextBox>

</td>

</tr>

<tr>

<td>

COM:

</td>

<td>

<telerik:RadMaskedTextBox ID="RadMaskedTextBox2"

Text='<%# Bind("COM") %>' Runat="server" Width="200px"

DisplayMask="(###) ###-####" Mask="(###) ###-####" Skin="Hay">

</telerik:RadMaskedTextBox>

</td>

</tr>

<tr>

<td>

Fax:

</td>

<td>

<telerik:RadMaskedTextBox ID="RadMaskedTextBox1"

Text='<%# Bind("Fax") %>' Runat="server" Width="200px"

DisplayMask="(###) ###-####" Mask="(###) ###-####" Skin="Hay">

</telerik:RadMaskedTextBox>

</td>

</tr>

<tr>

<td>

Email:

</td>

<td>

<telerik:RadTextBox ID="RadTextBox23" Runat="server" InvalidStyleDuration="100"

Text='<%# Bind("Email") %>' Width="200px" Skin="Hay">

</telerik:RadTextBox>

</td>

</tr>

</table>

</td>

<td class="style5">

&nbsp;</td>

<td class="style4">

<table ID="Table5" border="0" cellpadding="1" cellspacing="1">

<tr>

<td class="style6">

Service:

</td>

<td>

<telerik:RadComboBox ID="DDL_Service" Runat="server" DataSourceID="SDS_Service"

DataTextField="Service" DataValueField="ServiceID" DropDownWidth="175px"

Height="100px" SelectedValue='<%# Bind("ServiceID") %>' Skin="Hay"

Width="150px">

<CollapseAnimation Duration="200" Type="OutQuint" />

</telerik:RadComboBox>

</td>

</tr>

<tr>

<td class="style6">

Organization:

</td>

<td>

<telerik:RadComboBox ID="DDL_Organization" Runat="server" Height="100px"

Width="150px" DataSourceID="SDS_Organization" DataTextField="Organization"

DataValueField="OrganizationID" DropDownWidth="175px" Skin="Hay"

SelectedValue='<%# Bind("OrganizationID") %>'>

<CollapseAnimation Duration="200" Type="OutQuint" />

</telerik:RadComboBox>

</td>

</tr>

<tr>

<td class="style6">

TechArea:

</td>

<td>

<telerik:RadTextBox ID="RadTextBox38" Runat="server" InvalidStyleDuration="100"

Text='<%# Bind("TechArea") %>' Width="200px" Skin="Hay">

</telerik:RadTextBox>

</td>

</tr>

<tr>

<td class="style6">

<asp:Label ID="Label4" runat="server" Text="Non-Disclosure Signed"

Width="100px"></asp:Label>

</td>

<td>

<asp:CheckBox ID="Chk_nondisc" checked='<%# Bind("nondisc") %>' runat="server"

oncheckedchanged="Chk_nondisc_CheckedChanged" />

</td>

</tr>

<tr>

<td class="style6">

<asp:Label ID="Label6" runat="server" Text="Non-Disclosure Signed Date"

Width="100px"></asp:Label>

</td>

<td>

<asp:Label ID="LBL_disclosure_signed" runat="server" Text='<%# Bind("disclosure_signed") %>'

Width="100px"></asp:Label>

</td>

</tr>

</table>

</td>

</tr>

</table>

<table ID="table3" border="0" cellpadding="1" cellspacing="2" rules="none"

style="border-collapse: collapse; background: white;" width="100%">

<tr>

<td align="left" class="style8">

AccessLevels:

</td>

<td align="left">

&nbsp;</td>

</tr>

<tr>

<td align="left" class="style7">

<asp:CheckBoxList ID="CHKList_AccessLevel" runat="server"

DataSourceID="SDS_AccessLevel" DataTextField="AccessLevelName"

DataValueField="AccessLevelCode"

RepeatColumns="2">

</asp:CheckBoxList>

</td>

</tr>

<tr>

<td align="left" colspan="2">

&nbsp;</td>

</tr>

<tr>

<td align="left" colspan="2">

<asp:LinkButton ID="btnUpdate" runat="server"

CommandName='<%# Iif (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'

Text='<%# Iif (TypeOf Container is GridEditFormInsertItem,"Insert", "Update") %>'>

</asp:LinkButton>

<asp:LinkButton ID="btnCancel" runat="server" CausesValidation="False"

CommandName="Cancel" Text="Cancel"></asp:LinkButton>

</td>

</tr>

</table>

</FormTemplate>

</EditFormSettings>

</

MasterTableView>

<GroupingSettings CaseSensitive="False" />

<ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True"

ColumnsReorderMethod="Reorder" EnableRowHoverStyle="True">

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

</ClientSettings>

</

telerik:RadGrid>

<

asp:SqlDataSource ID="SDS_UserInfo" runat="server"

ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

DeleteCommand="DELETE FROM [tblUsers] WHERE [UserID] = @UserID"

InsertCommand="INSERT INTO [tblUsers] ([UserName], [Password], [Name], [OrganizationID], [AccessLevel], [DSN], [COM], [Fax], [Email], [TechArea], [ServiceID], [nondisc], [disclosure_signed]) VALUES (@UserName, @Password, @Name, @OrganizationID, @AccessLevel, @DSN, @COM, @Fax, @Email, @TechArea, @ServiceID, @nondisc, @disclosure_signed)"

SelectCommand="SELECT tblUsers.UserID, tblUsers.UserName, tblUsers.Password, tblUsers.Name, tblUsers.AccessLevel, tblUsers.DSN, tblUsers.COM, tblUsers.Fax, tblUsers.Email, tblUsers.TechArea, tblUsers.ServiceID, tblUsers.nondisc, tblUsers.disclosure_signed, tbl_Service.Service, tbl_Organizations.Organization, tblUsers.OrganizationID FROM tblUsers INNER JOIN tbl_Service ON tblUsers.ServiceID = tbl_Service.ServiceID INNER JOIN tbl_Organizations ON tblUsers.OrganizationID = tbl_Organizations.OrganizationID"

UpdateCommand="UPDATE [tblUsers] SET [UserName] = @UserName, [Password] = @Password, [Name] = @Name, [OrganizationID] = @OrganizationID, [AccessLevel] = @AccessLevel, [DSN] = @DSN, [COM] = @COM, [Fax] = @Fax, [Email] = @Email, [TechArea] = @TechArea, [ServiceID] = @ServiceID, [nondisc] = @nondisc, [disclosure_signed] = @disclosure_signed WHERE [UserID] = @UserID">

<DeleteParameters>

<asp:Parameter Name="UserID" Type="Int32" />

</DeleteParameters>

<UpdateParameters>

<asp:Parameter Name="UserName" Type="String" />

<asp:Parameter Name="Password" Type="String" />

<asp:Parameter Name="Name" Type="String" />

<asp:Parameter Name="OrganizationID" Type="Int32" />

<asp:Parameter Name="AccessLevel" Type="Int32" />

<asp:Parameter Name="DSN" Type="String" />

<asp:Parameter Name="COM" Type="String" />

<asp:Parameter Name="Fax" Type="String" />

<asp:Parameter Name="Email" Type="String" />

<asp:Parameter Name="TechArea" Type="String" />

<asp:Parameter Name="ServiceID" Type="Int32" />

<asp:Parameter Name="nondisc" Type="Int32" />

<asp:Parameter Name="disclosure_signed" Type="DateTime" />

<asp:Parameter Name="UserID" Type="Int32" />

</UpdateParameters>

<InsertParameters>

<asp:Parameter Name="UserName" Type="String" />

<asp:Parameter Name="Password" Type="String" />

<asp:Parameter Name="Name" Type="String" />

<asp:Parameter Name="OrganizationID" Type="Int32" />

<asp:Parameter Name="AccessLevel" Type="Int32" />

<asp:Parameter Name="DSN" Type="String" />

<asp:Parameter Name="COM" Type="String" />

<asp:Parameter Name="Fax" Type="String" />

<asp:Parameter Name="Email" Type="String" />

<asp:Parameter Name="TechArea" Type="String" />

<asp:Parameter Name="ServiceID" Type="Int32" />

<asp:Parameter Name="nondisc" Type="Int32" />

<asp:Parameter Name="disclosure_signed" Type="DateTime" />

</InsertParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="SDS_UserRoles" runat="server"

ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

DataSourceMode="DataReader"

SelectCommand="SELECT * FROM [tbl_user_role] WHERE ([FK_user] = @FK_user)">

<SelectParameters>

<asp:ControlParameter ControlID="RadGrid1" Name="FK_user"

PropertyName="SelectedValue" Type="Int32" />

</SelectParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="SDS_Service" runat="server"

ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

SelectCommand="SELECT * FROM [tbl_Service]"></asp:SqlDataSource>

<asp:SqlDataSource ID="SDS_Organization" runat="server"

ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

SelectCommand="SELECT * FROM [tbl_Organizations]"></asp:SqlDataSource>

<asp:SqlDataSource ID="SDS_AccessLevel" runat="server"

ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

SelectCommand="SELECT * FROM [tbl_AccessLevels]"></asp:SqlDataSource>

</

asp:Content>

VB CODE:

Private Sub RadGrid1_EditCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.EditCommand

'For Each item In RadGrid1.EditItems

' Dim itemToEdit As GridEditableItem = CType(item.EditFormItem, GridEditableItem)

' 'perform further operations

' Dim CHKList_AccessLevel1 As CheckBoxList = CType(itemToEdit.FindControl("CHKList_AccessLevel"), CheckBoxList)

'Next item

''Get the GridEditableItem of the RadGrid

'Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditFormItem)

''Access the CheckBoxList from the edit form template and store the values in string variables.

'Dim CHKList_AccessLevel1 As CheckBoxList = CType(editedItem.FindControl("AccessLevel"), CheckBoxList)

'Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)

'Dim mydatatable As New DataTable

'Dim myreader As SqlDataReader

'Dim myconnection As New SqlConnection

'myconnection.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString

'Dim fk_user As New SqlParameter

'fk_user.ParameterName = "@FK_user"

'fk_user.Value = dataItem("UserID").Text

'Dim SelectCommand = "SELECT * FROM [tbl_user_role] WHERE ([FK_user] = @FK_user)"

'Dim mycommand As New SqlCommand

'mycommand.CommandText = SelectCommand

'mycommand.Connection = myconnection

'mycommand.Parameters.Add(fk_user)

'mycommand.Connection.Open()

'myreader = mycommand.ExecuteReader(CommandBehavior.CloseConnection)

'mydatatable.Load(myreader)

'Dim i = 0

'If mydatatable.Rows.Count > 0 Then

' 'If Not CHKList_AccessLevel1 Is Nothing Then

' For i = 0 To CHKList_AccessLevel1.Items.Count - 1

' For Each row In mydatatable.Rows

' If CHKList_AccessLevel1.Items(i).Value = mydatatable.Rows.Item(0).Item("fk_role").ToString Then

' CHKList_AccessLevel1.Items(i).Selected = True

' End If

' Next

' Next i

' 'End If

'End If

End Sub

Private Sub RadGrid1_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand

End Sub

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand

If e.CommandName = RadGrid.InitInsertCommandName Then '"Add new" button clicked

Dim editColumn As GridEditCommandColumn = CType(RadGrid1.MasterTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn)

editColumn.Visible =

False

e.Canceled =

True

'Prepare an IDictionary with the predefined values

Dim newValues As System.Collections.Specialized.ListDictionary = New System.Collections.Specialized.ListDictionary()

'set default checked state for checkbox inside the EditItemTemplate

newValues(

"nondisc") = False

'Insert the item and rebind

e.Item.OwnerTableView.InsertItem(newValues)

ElseIf (e.CommandName = RadGrid.RebindGridCommandName AndAlso e.Item.OwnerTableView.IsItemInserted) Then

e.Canceled =

True

Else

Dim editColumn As GridEditCommandColumn = CType(RadGrid1.MasterTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn)

If Not editColumn.Visible Then

editColumn.Visible =

True

End If

End If

'If TypeOf e.Item Is GridEditFormItem Then

' Dim editedItem As GridEditFormItem = CType(e.Item, GridEditFormItem)

' CHKList_AccessLevel1 = CType(editedItem.FindControl("CHKList_AccessLevel"), CheckBoxList)

'End If

'saves old values to session if needed

'If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then

' Dim lbl_sign_date As Label = CType(e.Item.FindControl("LBL_disclosure_signed"), Label)

' Session("savedOldValue") = lbl_sign_date.Text

'End If

End Sub

Public Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

If TypeOf e.Item Is GridDataItem Then

Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)

'set delete confim

Dim UserName As String = dataItem("UserName").Text

Dim button As LinkButton = CType(dataItem("Delete").Controls(0), LinkButton)

button.Attributes(

"onclick") = "return confirm('Are you sure you want to delete " & UserName & " User from database?')"

End If

'set checkbox list for access level

If (TypeOf (e.Item) Is GridEditableItem And e.Item.IsInEditMode) Then

Dim CHKList_AccessLevel As CheckBoxList = CType(e.Item, GridEditFormItem)("AccessLevel").FindControl("CHKList_AccessLevel")

'Dim dataItem As GridDataItem = CType(e.Item, GridEditableItem)

Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditFormItem)

'Dim CHKList_AccessLevel As CheckBoxList = CType(sender, CheckBoxList)

Dim item As GridEditFormItem = CType(CHKList_AccessLevel.NamingContainer, GridEditFormItem)

Dim mydatatable As New DataTable

Dim myreader As SqlDataReader

Dim myconnection As New SqlConnection

myconnection.ConnectionString = ConfigurationManager.ConnectionStrings(

"ConnectionString").ConnectionString

Dim fk_user As New SqlParameter

fk_user.ParameterName =

"@FK_user"

fk_user.Value = editedItem(

"UserID").Text

Dim SelectCommand = "SELECT * FROM [tbl_user_role] WHERE ([FK_user] = @FK_user)"

Dim mycommand As New SqlCommand

mycommand.CommandText = SelectCommand

mycommand.Connection = myconnection

mycommand.Parameters.Add(fk_user)

mycommand.Connection.Open()

myreader = mycommand.ExecuteReader(CommandBehavior.CloseConnection)

mydatatable.Load(myreader)

Dim i = 0

If mydatatable.Rows.Count > 0 Then

'If Not CHKList_AccessLevel Is Nothing Then

For i = 0 To CHKList_AccessLevel.Items.Count - 1

For Each row In mydatatable.Rows

If CHKList_AccessLevel.Items(i).Value = mydatatable.Rows.Item(0).Item("fk_role").ToString Then

CHKList_AccessLevel.Items(i).Selected =

True

End If

Next

Next i

'End If

End If

End If

End Sub

Protected Sub RadGrid1_ItemDeleted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDeletedEventArgs) Handles RadGrid1.ItemDeleted

If Not e.Exception Is Nothing Then

e.ExceptionHandled =

True

DisplayMessage(

True, "Record " + e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("UserID").ToString() + " cannot be deleted. Reason: " + e.Exception.Message)

Else

DisplayMessage(

False, "Record " + e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("UserID").ToString() + " deleted")

End If

End Sub

Protected Sub RadGrid1_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles RadGrid1.ItemInserted

If Not e.Exception Is Nothing Then

e.ExceptionHandled =

True

e.KeepInInsertMode =

True

DisplayMessage(

True, "User cannot be inserted. Reason: " + e.Exception.Message)

Else

DisplayMessage(

False, "User inserted")

End If

End Sub

Protected Sub RadGrid1_ItemUpdated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs) Handles RadGrid1.ItemUpdated

If Not e.Exception Is Nothing Then

e.KeepInEditMode =

True

e.ExceptionHandled =

True

DisplayMessage(

True, "User item " + e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("UserID").ToString() + " cannot be updated. Reason: " + e.Exception.Message)

Else

DisplayMessage(

False, "User item " + e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("UserID").ToString() + " updated")

End If

End Sub

Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender

If (Not Page.IsPostBack) Then

'RadGrid1.EditIndexes.Add(0)

RadGrid1.Rebind()

End If

End Sub

Private Sub DisplayMessage(ByVal isError As Boolean, ByVal text As String)

Dim label As Label = IIf(isError, Me.Label1, Me.Label2)

label.Text = text

End Sub

Protected Sub Chk_nondisc_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)

'grab checkbox from template form and reset signed date value

Dim box As CheckBox = CType(sender, CheckBox)

Dim item As GridEditFormItem = CType(box.NamingContainer, GridEditFormItem)

Dim lbl_signed As Label = CType(item.FindControl("LBL_disclosure_signed"), Label)

Dim signed_date As Date = Now()

If box.Checked Then

lbl_signed.Text = signed_date

Else

lbl_signed.Text =

Nothing

End If

End Sub

Public Function Check_ClickedAccessLevel(ByVal sender As Object, ByVal e As EventArgs)

' ''grab checkbox from template form and reset signed date value

''Dim CHKList_AccessLevel As CheckBoxList = CType(sender, CheckBoxList)

''Dim item As GridEditFormItem = CType(CHKList_AccessLevel.NamingContainer, GridEditFormItem)

' '' Make sure a control was found.

''If Not CHKList_AccessLevel Is Nothing Then

'' ' Iterate through the Items collection of CheckBoxList

'' ' control and capture the selected items.

'' Dim i As Integer

'' For SDS_UserRoles.

'' For i = 0 To CHKList_AccessLevel.Items.Count - 1

'' If CHKList_AccessLevel.Items(i).Selected Then

'' CHKList_AccessLevel.Items(i).Selected = True

'' End If

'' Next i

'' Next

'' 'Return StrAccesslevel

''Else

'' ' Display an error message.

'' 'StrAccesslevel = "Unable to find CheckBoxList control."

'' 'lbltest.Text = message

''End If

'Dim CHKList_AccessLevel1 As CheckBoxList = CType(sender, CheckBoxList)

'Dim item As GridEditFormItem = CType(CHKList_AccessLevel1.NamingContainer, GridEditFormItem)

'CHKList_AccessLevel1.DataSource = SDS_UserRoles

'CHKList_AccessLevel1.DataValueField = "fk_role"

'CHKList_AccessLevel1.DataBind()

 

End Function

 

Private Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand

''first reference the edited grid item through the NamingContainer attribute

'Dim editedItem As GridEditableItem = CType(CType(source, CheckBoxList).NamingContainer, GridEditableItem)

''grab checkbox from template form and reset signed date value

'Dim CHKList_AccessLevel1 As CheckBoxList = CType(editedItem.FindControl("CHKList_AccessLevel"), CheckBoxList)

'Dim Gitem As GridEditFormItem = CType(CHKList_AccessLevel1.NamingContainer, GridEditFormItem)

' ''set checkboxlist values

'For Each Item As ListItem In CHKList_AccessLevel1.Items

' If Item.Selected Then

' SDS_UserRoles.Insert()

' Else

' SDS_UserRoles.Delete()

' End If

'Next

End Sub

Protected Sub CHKList_AccessLevel_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

''first reference the edited grid item through the NamingContainer attribute

'Dim editedItem As GridEditableItem = CType(CType(sender, CheckBoxList).NamingContainer, GridEditableItem)

''grab checkbox from template form and reset signed date value

'Dim CHKList_AccessLevel1 As CheckBoxList = CType(editedItem.FindControl("CHKList_AccessLevel"), CheckBoxList)

''Dim Gitem As GridEditFormItem = CType(CHKList_AccessLevel1.NamingContainer, GridEditFormItem)

' ''set checkboxlist values

'For Each Item As ListItem In CHKList_AccessLevel1.Items

' If Item.Selected Then

' Dim FK_user1 As Integer

' Dim Fk_role1 As Integer

' Dim CreateDate1 As Date

' Dim checkvalue As String = CHKList_AccessLevel1.SelectedValue

' SDS_UserRoles.InsertParameters.Add(FK_user1, Session("UserID"))

' SDS_UserRoles.InsertParameters.Add(Fk_role1, checkvalue)

' SDS_UserRoles.InsertParameters.Add(CreateDate1, Now())

' SDS_UserRoles.Insert()

' Else

' SDS_UserRoles.Delete()

' End If

'Next

End Sub

Shinu
Top achievements
Rank 2
 answered on 30 Jul 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?