iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
hi:
1.i want to make one column's property in the grid that cant'n be edit,i know just set the edittype=noedit,but after set that, i still can edit that column.,why?2.i want to make a cell's style to be combo that the column value can be alternative in the grid,i have seen the samples,they are all make the column bind to data base ,but i don't want to make the column whose style is combo bind to data base ,i wonder if it can be just write the alternative values in the combo, and bind the combo to the grid ,is this ok? how to realize this? thank you for your help,our company is the webui agent in china,i want to learn this,i am new for this~
Hi Bernard,
thank you very much! I have solve my doubtful point now! if I want to trigger the event oninitializedatasource="WebGrid1_InitializeDataSource"
Hi su su,
If you want to make the column can’t be edited, you can just set the EditType=”NoEdit”. But maybe in your case the EditType property is setted in wrong tag so that make the column still can be edited.
For the second case, I’ve made my own sample using Northwind as project’s database. You can make unbound column on bound WebGrid. But when you edit the unbound column, the value will be lost because it is not stored in database and the WebGrid refresh itself after updating process.
However it is possible to use unbound data in combo. I enclose a sample about how to use unbound WebCombo which integrate into WebGrid. In this case, I configure it in Discontinued column.
Hope this helps.
Regards,
Bernard
I have found the problem that make the setting noedit not work,i wrote a filter code behind in initializedatasource,preparedatabind and initializelayout,such as follows:
protected void WebGrid1_InitializeDataSource(object sender, DataSourceEventArgs e) { SqlConnection sqlcon = new SqlConnection("Data Source = (local); Database = su; Uid = sa; Pwd = sss123456;"); string SqlStr = "select * from BIAO"; SqlDataAdapter da = new SqlDataAdapter(SqlStr, sqlcon); DataSet ds = new DataSet(); try { sqlcon.Open(); da.Fill(ds); e.DataSource = ds; } catch (Exception ee) { Response.Write(ee.Message); } finally { sqlcon.Close(); } }
protected void WebGrid1_PrepareDataBinding(object sender, DataSourceEventArgs e) { if (!IsPostBack) { WebGrid1.RetrieveStructure(); } if (WebCombo1.Text != "") { WebGridFilter a = new WebGridFilter(); a.ColumnMember = "StuGrade"; a.FilterType = ISNet.WebUI.WebGrid.ColumnFilterType.EqualTo; a.FilterText = WebCombo1.Text; WebGrid1.RootTable.FilteredColumns.Add(a); if (WebCombo2.Text != "") {
WebGridFilter b = new WebGridFilter(); b.ColumnMember = "StuClass"; b.FilterType = ISNet.WebUI.WebGrid.ColumnFilterType.EqualTo; b.FilterText = WebCombo2.Text; WebGrid1.RootTable.FilteredColumns.Add(b); } }
}
protected void WebGrid1_InitializeLayout(object sender, LayoutEventArgs e) { e.Layout.AllowFilter = ISNet.WebUI.WebGrid.Filter.Yes;
when i open these codes,the properties of one column NoEdit that does not work,it still can edit.i don't konw why ,would please give me a hand,thanks very much!
I’ve look on your code and I didn’t see the EditType there. Where do you want to put the EditType property? For the filtering, is the WebCombo will integrated to WebGrid? If you want WebCombo’s value cannot be edited, you can do it with changing TextBoxMode property on Layout Settings to ReadOnly value. For WebGrid Column, if you want to set EditType on WebGrid, you can put it on PrepareDataBinding event. PrepareDataBinding event executed when WebGrid retrieve the column structure and create necessary object.
I’ve made my own sample. In my sample, I using Northwind as my project’s Database and DataSet. I also put Unbound WebCombo as Filter Type. Hope this helps.
thank you for your help,but I still have some doubts,for example:I make a grid ,it has some columns,such as StuNo,StuName,StuSex,StuGrade,StuClass,StuTelNo,StuAdd,now I want to set the property of StuNo to EditType="NoEdit",see the before codes as follows,
<ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="301px" UseDefaultStyle="True" Width="813px" DataSourceID="ISDataSource1" DataMember="BIAO" DefaultStyleMode="Elegant"> <RootTable DataKeyField="StuNo" Caption="BIAO" DataMember="BIAO" ColumnFooters="Yes"> <Columns> <ISWebGrid:WebGridColumn Caption="StuNo" DataMember="StuNo" Name="StuNo" EditType="NoEdit" Width="100px" AggregateFunction="Count" FooterText="总学生数"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="StuName" DataMember="StuName" Name="StuName" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="StuSex" DataMember="StuSex" Name="StuSex" Width="100px" EditType="WebComboNET" WebComboID="WebCombo3"> <ValueList DataMember="TbSex1" DataTextField="StuSex" DataSourceID="ISDataSource1" DataValueField="StuSex"> </ValueList> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="StuGrade" DataMember="StuGrade" Name="StuGrade" Width="100px" EditType="WebComboNET" WebComboID="WebCombo1"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="StuClass" DataMember="StuClass" Name="StuClass" Width="100px" EditType="WebComboNET" WebComboID="WebCombo2"> <ValueList DataMember="TbClass" DataSourceID="ISDataSource1" DataTextField="StuClass" DataValueField="StuClass"> </ValueList> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="StuTelNo" DataMember="StuTelNo" Name="StuTelNo" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="StuAdd" DataMember="StuAdd" Name="StuAdd" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ExistFlag" DataMember="ExistFlag" Name="ExistFlag" Width="100px"> </ISWebGrid:WebGridColumn> </Columns> </RootTable> <LayoutSettings AllowDelete="Yes" AllowContextMenu="true" AllowEdit="Yes" AllowAddNew="Yes" AllowFilter="Yes" PagingMode="ClassicPaging" AllowExport="Yes"> </LayoutSettings> </ISWebGrid:WebGrid>
I write a filter code in behind:
now i just konw that the filter code cause the StuNo's NoEdit didn't work,it still can editable,but i don't konw why,are they have some conflict when they used at the same time,would please give me some ideas? thank yo very much!
I still can’t replicate your issue in our local end. But from your information, the server-side code is not executed because you doesn’t set the event handler on design view. If you have bind the database in design view, you don't need to bind the database programmatically. From your information, I’ve made my own sample which have the same structure as yours. In my sample I use Northwind as my database and my DataSet If you don’t mind, could you edit my sample to replicate your issue in my sample? Look forward to heard any news from you so we can assist you further.
I have seen your sample,you wrote the filter code in behind,you didn't trigger the event such as InitializeDatabase PrepareDatabind and InitializeLayout,so they don't excute the filter code?
for my before code it has oninitializedatasource="WebGrid1_InitializeDataSource"
oninitializelayout="WebGrid1_InitializeLayout1" onpreparedatabinding="WebGrid1_PrepareDataBinding1" ,your codes don't has these event, would you please have a try? thank you very much!
Glad to hear that you have solved the problem. For references of WebGrid, you can see the tutorial video at http://intersoftpt.com/Support/WebGrid/Tutorial/ . And if you have any further question, please don't hesitate to ask us. We will gladly assist you.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname