This is a migrated thread and some comments may be shown as answers.

Accessing Grid Column Values on server side when grid is bind on client side

2 Answers 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brendom
Top achievements
Rank 1
Brendom asked on 07 Oct 2015, 01:36 PM
 This is my RadGrid which i have bind from json on client side javascript but i want to access this grid values on server side in my code behind file.
 
<telerik:RadGrid ID="radGridView2" runat="server" AllowSorting="True"<br>            OnNeedDataSource="radGridView2_NeedDataSource"<br>            Width="800px" GroupPanelPosition="Top" <br>             ResolvedRenderMode="Classic" <br>            Height="35em" Enabled="False"><br>             <ClientSettings><br>                    <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling><br>                    <Selecting AllowRowSelect="True" /><br>                    <ClientEvents OnRowSelected="RowSelected" /><br>                </ClientSettings><br>                <br>                 <SelectedItemStyle BorderStyle="Dashed"<br>                    BorderWidth="1px"/><br>       <MasterTableView AutoGenerateColumns="False"><br>    <Columns><br>      <telerik:GridBoundColumn  DataField="SNO" UniqueName="SNO" HeaderText="SN#"><br>      <HeaderStyle Width="10px"/><br>      </telerik:GridBoundColumn><br>       <telerik:GridBoundColumn DataField="INITIAL" UniqueName="INITIAL" HeaderText="TYPE"><br>       <HeaderStyle Width="10px"/><br>      </telerik:GridBoundColumn><br>       <telerik:GridBoundColumn DataField="TITLE" UniqueName="TITLE" HeaderText="ACCOUNT TITLE"><br>      <HeaderStyle Width="80px"/><br>      </telerik:GridBoundColumn><br>      <telerik:GridBoundColumn DataField="DISC" UniqueName="DISC" HeaderText="DESCRIPTION" Resizable="False"><br>      <HeaderStyle Width="160px"/><br>      </telerik:GridBoundColumn><br>       <telerik:GridBoundColumn DataField="JOB" UniqueName="JOB" HeaderText="COST CENTER"><br>      <HeaderStyle Width="55px"/><br>      </telerik:GridBoundColumn><br>       <telerik:GridBoundColumn DataField="dRR" UniqueName="dRR" HeaderText="DEBIT" DataFormatString="{0:N}"><br>    <HeaderStyle Width="35px"/><br>      </telerik:GridBoundColumn><br>       <telerik:GridBoundColumn DataField="cRR" UniqueName="cRR" HeaderText="CREDIT" DataFormatString="{0:N}"><br>      <HeaderStyle Width="35px"/><br>      </telerik:GridBoundColumn><br>      <telerik:GridBoundColumn DataField="acno" UniqueName="acno" HeaderText="acno" Visible="false" ><br>      <HeaderStyle Width="35px"/><br>      </telerik:GridBoundColumn><br>        <telerik:GridBoundColumn DataField="job_id" UniqueName="job_id" HeaderText="job_id" Visible="false" ><br>      <HeaderStyle Width="35px"/><br>      </telerik:GridBoundColumn><br>           <telerik:GridBoundColumn DataField="U_INSERT" UniqueName="U_INSERT" HeaderText="U_INSERT" Visible="false" ><br>      <HeaderStyle Width="35px"/><br>      </telerik:GridBoundColumn><br>        <telerik:GridBoundColumn DataField="I_DATE" UniqueName="I_DATE" HeaderText="I_DATE" Visible="false" ><br>      <HeaderStyle Width="35px"/><br>      </telerik:GridBoundColumn><br>    </Columns><br>  </MasterTableView><br>  <ClientSettings><br>    <ClientEvents OnCommand="function(){}" /><br>  </ClientSettings><br>        <ItemStyle BorderStyle="Ridge" /><br>        </telerik:RadGrid>  <br>

 

This is how i am accessing my RadGrid

 

<p style=" background-color: #fff;"><font color="#000000" face="monospace"> foreach (GridDataItem item in radGridView2.Items)<br>                {<br>                    string idd1 = item["acno"].Text.Trim();<br>                    string type = item["INITIAL"].Text.Trim();<br>                    string jbid = item["job_id"].Text.Trim();<br>                    string disc = item["DISC"].Text.Trim();<br>                    string dRR1 = item["dRR"].Text.Trim().Replace(",", "");<br>                    string cRR1 = item["cRR"].Text.Trim().Replace(",", "");<br>                    string un1 = item["U_INSERT"].Text.Trim();</font></p><p style=" background-color: #fff;"><font color="#000000" face="monospace">}​</font></p>
 foreach (GridDataItem item in radGridView2.Items)
                {
                    string idd1 = item["acno"].Text.Trim();
                    string type = item["INITIAL"].Text.Trim();
                    string jbid = item["job_id"].Text.Trim();
                    string disc = item["DISC"].Text.Trim();
                    string dRR1 = item["dRR"].Text.Trim().Replace(",", "");
                    string cRR1 = item["cRR"].Text.Trim().Replace(",", "");
                    string un1 = item["U_INSERT"].Text.Trim();

}

But the columns are coming " &nbsp; " What i am doing wrong here ?

2 Answers, 1 is accepted

Sort by
0
Brendom
Top achievements
Rank 1
answered on 08 Oct 2015, 04:53 AM
Come on anyone answer ? Or give me some type of sort or suggestion
0
Kostadin
Telerik team
answered on 12 Oct 2015, 06:47 AM
Hi Brendom,

I am afraid that you cannot access the values on the server when using a client-side binding. Nevertheless, you can access them on the client by using the client API.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Brendom
Top achievements
Rank 1
Answers by
Brendom
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or