Search Results

Search found 4489 results on 180 pages for 'ng grid'.

Page 31/180 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Trouble binding command in grid menu item.

    - by Pete
    I have a grid that's inside a usercontrol derived class called MediatedUserControl. I'm adding a context menu to let the user delete an item, but I've been unable to figure out how to bind the command to my command property. I'm using MVVM and my viewmodel implements a public ICommand property called DeleteSelectedItemCommand. However, when the view is displayed, I get the following message in the output window: System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='BRO.View.MediatedUserControl', AncestorLevel='1''. BindingExpression:Path=DataContext.DeleteSelectedItemCommand; DataItem=null; target element is 'BarButtonItem' (HashCode=6860584); target property is 'Command' (type 'ICommand') I feel like I generally have a good handle on bindings like this and can't figure out what it is I'm missing here. Thanks for any help you can provide. <dxg:GridControl HorizontalAlignment="Left" Margin="12,88,0,0" x:Name="gridControl1" VerticalAlignment="Top" Height="500" Width="517" DataSource="{Binding ItemList}" BorderBrush="{StaticResource {x:Static SystemColors.ActiveBorderBrushKey}}" ShowBorder="True" Background="{StaticResource {x:Static SystemColors.ControlLightBrushKey}}" UseLayoutRounding="False" DataContext="{Binding}"> <dxg:GridControl.Columns> <dxg:GridColumn FieldName="Code" Header="Code" Width="107" /> <dxg:GridColumn FieldName="Name" Header="Item" Width="173" /> <dxg:GridColumn FieldName="PricePerItem" Header="Unit Price" Width="70"> <dxg:GridColumn.EditSettings> <dxe:TextEditSettings DisplayFormat="N2" /> </dxg:GridColumn.EditSettings> </dxg:GridColumn> <dxg:GridColumn FieldName="Quantity" Header="Qty" Width="50" AllowEditing="True" /> <dxg:GridColumn FieldName="TotalPrice" Header="Total Price" Width="90"> <dxg:GridColumn.EditSettings> <dxe:TextEditSettings DisplayFormat="N2" /> </dxg:GridColumn.EditSettings> </dxg:GridColumn> </dxg:GridControl.Columns> <dxg:GridControl.View> <dxg:TableView ShowIndicator="False" ShowGroupPanel="False" MultiSelectMode="Row" AllowColumnFiltering="False" AllowBestFit="False" AllowFilterEditor="False" AllowEditing="False" AllowGrouping="False" AllowSorting="False" AllowResizing="False" AllowMoving="False" AllowMoveColumnToDropArea="False" AllowDateTimeGroupIntervalMenu="False" > <dxg:TableView.RowCellMenuCustomizations> <dxb:BarButtonItem Name="deleteRowItem" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=view:MediatedUserControl, AncestorLevel=1}, Path=DataContext.DeleteSelectedItemCommand}"> </dxb:BarButtonItem> </dxg:TableView.RowCellMenuCustomizations> </dxg:TableView> </dxg:GridControl.View>

    Read the article

  • Add new row to asp .net grid view using button

    - by SARAVAN
    Hi, I am working in ASP .net 2.0. I am a learner. I have a grid view which has a button in it. Please find the asp mark up below <form id="form1" runat="server"> <div> <asp:GridView ID="myGridView" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Button CommandName="AddARowBelow" Text="Add A Row Below" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </div> </form> Please find the code behind below. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Data; using System.Web.UI.WebControls; namespace GridViewDemo { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable("myTable"); dt.Columns.Add("col1"); dt.Columns.Add("col2"); dt.Columns.Add("col3"); dt.Rows.Add(1, 2, 3); dt.Rows.Add(1, 2, 3); dt.Rows.Add(1, 2, 3); dt.Rows.Add(1, 2, 3); dt.Rows.Add(1, 2, 3); myGridView.DataSource = dt; myGridView.DataBind(); } protected void myGridView_RowCommand(object sender, GridViewCommandEventArgs e) { } } } I was thinking that when I click the command button, it would fire the mygridview_rowcommand() but instead it threw an error as follows: Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" % in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Can any one let me know on where I am going wrong?

    Read the article

  • Dojo datagrid won't display inside another div

    - by Tom
    Hi, Trying to get a Dojo datagrid working - have duplicated the first example on the documentation page (http://docs.dojocampus.org/dojox/grid/DataGrid) & it works just fine. However, when I try to display the grid inside another div (i.e. putting 'gridContainer4' from the example inside any other div) nothing displays... Any help much appreciated - can't find anything about this anywhere online!

    Read the article

  • How to create layout for tower made of blocks

    - by sasquatch90
    I have a tower built from blocks like this : Whole Tower is an array of Towers. Each Tower contains Box[] array containing single Box'es.What layout should I use for this and can you give me any tips on how to create it ? Would it be easier if I would create Grid[][] containing Box'es? But I guess I can't store Box object inside Grid array. I'm just totally confused :/

    Read the article

  • Grid View Button Passing Data Via On Click

    - by flyersun
    Hi, I'm pretty new to C# and asp.net so aplogies if this is a really stupid question. I'm using a grid view to display a number of records from a database. Each row has an Edit Button. When the button is clicked I want an ID to be passed back to a funtion in my .cs file. How do I bind the rowID to the Button field? I've tired using a hyper link instead but this doens't seem to work because I'm posting back to the same page which already has a Permanter on the URL. asp.net <asp:GridView ID="gvAddresses" runat="server" onrowcommand="Edit_Row"> <Columns> <asp:ButtonField runat="server" ButtonType="Button" Text="Edit"> </Columns> </asp:GridView> c# int ImplantID = Convert.ToInt32(Request.QueryString["ImplantID"]); Session.Add("ImplantID", ImplantID); List<GetImplantDetails> DataObject = ImplantDetails(ImplantID); System.Data.DataSet DSImplant = new DataSet(); System.Data.DataTable DTImplant = new DataTable("Implant"); DSImplant.Tables.Add(DTImplant); DataColumn ColPostCode = new DataColumn(); ColPostCode.ColumnName = "PostCode"; ColPostCode.DataType = typeof(string); DTImplant.Columns.Add(ColPostCode); DataColumn ColConsigneeName = new DataColumn(); ColConsigneeName.ColumnName = "Consignee Name"; ColConsigneeName.DataType = typeof(string); DTImplant.Columns.Add(ColConsigneeName); DataColumn ColIsPrimaryAddress = new DataColumn(); ColIsPrimaryAddress.ColumnName = "Primary"; ColIsPrimaryAddress.DataType = typeof(int); DTImplant.Columns.Add(ColIsPrimaryAddress); DataColumn ColImplantCustomerDetailsID = new DataColumn(); ColImplantCustomerDetailsID.ColumnName = "Implant ID"; ColImplantCustomerDetailsID.DataType = typeof(int); DTImplant.Columns.Add(ColImplantCustomerDetailsID); foreach (GetImplantDetails Object in DataObject) { DataRow DRImplant = DTImplant.NewRow(); DRImplant["PostCode"] = Object.GetPostCode(); DRImplant["Consignee Name"] = Object.GetConsigneeName(); DRImplant["Primary"] = Object.GetIsPrimaryAddress(); DRImplant["Implant ID"] = Object.GeTImplantCustomerDetailsID(); DTImplant.Rows.Add(DRImplant); <--- this is what I need to be added to the button } gvAddresses.DataSource = DTImplant; gvAddresses.DataBind();

    Read the article

  • WPF Toolkit: how to scroll datagrid to show selected item from code behind?

    - by Akash Kava
    I tried following, all of following fails on function ScrollIntoView and gives NullReferenceException. // doesnt work grid.SelectedItem = sItem; grid.ScrollIntoView(sItem); // doesnt work grid.SelectedItem = sItem; grid.Focus(); grid.CurrentColumn = grid.Columns[0]; grid.UpdateLayout(); grid.ScrollIntoView(sItem,grid.Columns[0]); // doesnt work grid.SelectedItem = sItem; grid.UpdateLayout(); grid.ScrollIntoView(sItem); The problem is, when I select row from codebehind, selection is not visible its somewhere down in bottom, unless user scrolls he feels that selection has vanished. I need to scroll datagrid to the point user can see the selection. I also tried "BringIntoView" as well but no luck.

    Read the article

  • How can I anchor a textbox in wpf ?

    - by csuporj
    I have a window with tabs. On one of the tabs, I have a layout like below. (In fact it is more complicated, I have 4 text boxes in a row, and I have more rows.) How can I make the 3rd textbox have the width of the label + the width of the text box above, that is, to have them properly aligned ? The problem is that WPF widens the 3rd textbox, when I type text into it. Using hardcoded numbers for the sizes defeats the whole purpose of WPF. I could do that way 10 times faster in Windows Forms than in WPF. Is there a better way, than using a grid for each set of consecutive small text boxes, having to skip the large ones from the grid, because putting them in messes up everything. <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <Style TargetType="{x:Type Label}"> <Setter Property="VerticalAlignment" Value="Center"/> </Style> <Style TargetType="{x:Type TextBox}"> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="Margin" Value="3"/> </Style> <Style x:Key="SmallTextBox" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}"> <Setter Property="Width" Value="50"/> </Style> </Window.Resources> <StackPanel VerticalAlignment="Top" HorizontalAlignment="Left" Width="{Binding ElementName=grid,Path=ActualWidth}" Grid.IsSharedSizeScope="True"> <Grid Name="grid" HorizontalAlignment="Left"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" SharedSizeGroup="c1"/> <ColumnDefinition Width="Auto" SharedSizeGroup="c2"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Label Content="Foo:"/> <TextBox Grid.Column="1" Style="{StaticResource SmallTextBox}"/> <Label Grid.Row="1" Content="Foobar:"/> <TextBox Grid.Row="1" Grid.Column="1" Style="{StaticResource SmallTextBox}"/> </Grid> <TextBox Grid.Row="1"/> <Grid Name="grid2" HorizontalAlignment="Left"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" SharedSizeGroup="c1"/> <ColumnDefinition Width="Auto" SharedSizeGroup="c2"/> </Grid.ColumnDefinitions> <Label Content="Bar:"/> <TextBox Grid.Column="1" Style="{StaticResource SmallTextBox}"/> </Grid> </StackPanel> </Window>

    Read the article

  • how to use multiple tab controls, and to be able to call a selected tab control with buttons.

    - by mojotaker
    Please I am trying to assign each button on the left its own Tab control. That is for example, when the Intake form button is pushed, it will have its own set of tabs (its own tabcontrols) am i supposed to place multiple tab controls on the artboard, or is there a way to programatically change the names of the tabs, and there contents, when a button is pushed on the left ? thank you in advance. and here is a link hxxp://img709.imageshack.us/img709/554/tabcontrol.gif here is the code so far <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Class="service.MainWindow" x:Name="Window" Title="MainWindow" Width="687" Height="480" mc:Ignorable="d"> <Window.Resources> <Storyboard x:Key="OnLoaded1"/> </Window.Resources> <Window.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Storyboard="{StaticResource OnLoaded1}"/> </EventTrigger> </Window.Triggers> <Grid x:Name="LayoutRoot" Margin="0,0,-16,1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="0*"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <DockPanel Margin="8,8,0,7" LastChildFill="False" Grid.Column="1" HorizontalAlignment="Left" Width="660"> <Menu VerticalAlignment="Top" Width="657" Height="32"> <MenuItem x:Name="file" Header="File"/> <MenuItem x:Name="edit" Header="Edit"> <MenuItem Width="100" Height="100" Header="MenuItem"/> </MenuItem> <MenuItem x:Name="view" Header="View"/> <MenuItem x:Name="preferences" Header="Preferences"/> <MenuItem x:Name="help" Header="Help"/> </Menu> </DockPanel> <TabControl x:Name="tabwin" Margin="137.224,46,19,7" Grid.Column="1"> <TabItem x:Name="intakeformsub" Header="Elegibility Form"> <Grid HorizontalAlignment="Left" Width="490"/> </TabItem> <TabItem Header="TabItem"> <Grid/> </TabItem> <TabItem Header="TabItem"> <Grid/> </TabItem> <TabItem Header="TabItem"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.567*"/> <ColumnDefinition Width="0.433*"/> </Grid.ColumnDefinitions> </Grid> </TabItem> <TabItem Header="TabItem"> <Grid/> </TabItem> <TabItem Header="TabItem"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.735*"/> <ColumnDefinition Width="0.265*"/> </Grid.ColumnDefinitions> </Grid> </TabItem> <TabItem Header="TabItem"> <Grid/> </TabItem> <TabItem Header="TabItem"> <Grid/> </TabItem> </TabControl> <Grid x:Name="___buttontab" Margin="11.205,61,0,0" Grid.Column="1" HorizontalAlignment="Left" Width="122.019" VerticalAlignment="Top" Height="276"> <Button VerticalAlignment="Top" Height="36" Content="Button"/> <Button Margin="0,40,0,0" Content="Oasis Assessments" VerticalAlignment="Top" Height="36"/> <Button Margin="0,80,0,0" VerticalAlignment="Top" Height="36" Content="Plan of Care"/> <Button Margin="0,120,0,0" VerticalAlignment="Top" Height="36" Content="Medication Profile" RenderTransformOrigin="0.421,5.556"/> <Button Margin="0,0,0,80" VerticalAlignment="Bottom" Height="36" Content="Clinical Notes"/> <Button Margin="0,0,0,40" VerticalAlignment="Bottom" Height="36" Content="Infection Control"/> <Button x:Name="intakeformbtn" VerticalAlignment="Top" Height="36" Content="Intake Form" Click="intakeform"> <Button.BindingGroup> <BindingGroup/> </Button.BindingGroup> </Button> <Button VerticalAlignment="Bottom" Height="36" Content="Discharge Summary"/> </Grid> <ProgressBar HorizontalAlignment="Left" Margin="8,0,0,7" VerticalAlignment="Bottom" Width="104.795" Height="19" Grid.Column="1"/> </Grid> </Window>

    Read the article

  • Why is two-way binding in silverlight not working?

    - by Edward Tanguay
    According to how Silverlight TwoWay binding works, when I change the data in the FirstName field, it should change the value in CheckFirstName field. Why is this not the case? ANSWER: Thank you Jeff, that was it, for others: here is the full solution with downloadable code. XAML: <StackPanel> <Grid x:Name="GridCustomerDetails"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="300"/> </Grid.ColumnDefinitions> <TextBlock VerticalAlignment="Center" Margin="10" Grid.Row="0" Grid.Column="0">First Name:</TextBlock> <TextBox Margin="10" Grid.Row="0" Grid.Column="1" Text="{Binding FirstName, Mode=TwoWay}"/> <TextBlock VerticalAlignment="Center" Margin="10" Grid.Row="1" Grid.Column="0">Last Name:</TextBlock> <TextBox Margin="10" Grid.Row="1" Grid.Column="1" Text="{Binding LastName}"/> <TextBlock VerticalAlignment="Center" Margin="10" Grid.Row="2" Grid.Column="0">Address:</TextBlock> <TextBox Margin="10" Grid.Row="2" Grid.Column="1" Text="{Binding Address}"/> </Grid> <Border Background="Tan" Margin="10"> <TextBlock x:Name="CheckFirstName"/> </Border> </StackPanel> Code behind: public Page() { InitializeComponent(); Customer customer = new Customer(); customer.FirstName = "Jim"; customer.LastName = "Taylor"; customer.Address = "72384 South Northern Blvd."; GridCustomerDetails.DataContext = customer; Customer customerOutput = (Customer)GridCustomerDetails.DataContext; CheckFirstName.Text = customer.FirstName; }

    Read the article

  • CentOS centralised logging, syslogd, rsyslog, syslog-ng, logstash sender?

    - by benbradley
    I'm trying to figure out the best way to setup a central place to store and interrogate server logs. syslog, Apache, MySQL etc. I've found a few different options but I'm not sure what would be best. I'm looking for something that is easy to install and keep updated on many virtual machines. I can add it to a VM template going forward but I'd also like it to be easy to install to keep the VM complexity down. The options I've found so far are: syslogd syslog-ng rsyslog syslogd/syslog-ng/rsyslog to logstash/ElasticSearch logstash agent in each log "client" to send to Redis/logstash/ElasticSearch And all sorts of permutations of the above. What's the most resilient and light from the log "client" perspective? I'd like to avoid the situation where log "clients" hang because they are unable to send their logs to the logging server. Also I would still like to keep local logging and the rotation/retention provided by logrotate in place. Any ideas/suggestions or reasons for or against any of the above? Or suggestions of a different structure entirely? Cheers, B

    Read the article

  • Templates and inheritance

    - by mariusz
    Hello, I have a big problem. I use additional controls for Wpf. One of them is Telerik RadWindow This control is already templated. Now I want to create custom Window with will inherit from RadWindow, and make custom template, eg. One base window will contains grid and two buttons, second base window will contain two grids (master - detail). The problem is that templates do not support inheritance. Perhaps is another way to template only the content of Winodow? My code, that doesn't work (empty window appears, so template doesn't apply) <Style TargetType="{x:Type local:TBaseRjWindow}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:TBaseRjContent}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid Name="mGrid"> <Grid.ColumnDefinitions> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition MaxHeight="40" MinHeight="30" /> <RowDefinition MaxHeight="40" MinHeight="30" /> <RowDefinition Height="Auto" /> <RowDefinition MaxHeight="40" MinHeight="30" /> </Grid.RowDefinitions> <telerik:RadGridView Margin="10,10,10,10" Name="grid" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ScrollMode="Deferred" AutoGenerateColumns="False" Width="Auto" > </telerik:RadGridView> <telerik:RadDataPager Grid.Row="1" Grid.Column="0" x:Name="radDataPager" PageSize="50" AutoEllipsisMode="None" DisplayMode="First, Previous, Next, Text" Margin="10,0,10,0"/> <StackPanel Grid.Row="1" Grid.Column="0" Margin="5 5 5 5" HorizontalAlignment="Left" Orientation="Horizontal" Height="20" Width="Auto" VerticalAlignment="Center" > <telerik:RadButton x:Name="btAdd" Margin="5 0 5 0" Content="Dodaj" /> <telerik:RadButton x:Name="btEdit" Margin="5 0 5 0" Content="Edytuj" /> <telerik:RadButton x:Name="btDelete" Margin="5 0 5 0" Content="Usun" /> </StackPanel> <StackPanel Name="addFields" Background="LightGray" Visibility="Collapsed" VerticalAlignment="Top" Grid.Row="2" Grid.Column="0" Width="Auto" Height="Auto" Orientation="Horizontal"> <GroupBox Header="Szczegoly" Margin="2 2 2 2" > <Grid VerticalAlignment="Top" DataContext="{Binding SelectedItem, ElementName=grid}" Name="_gAddFields" Margin="0 0 0 0" Width="Auto" Height="Auto" > </Grid> </GroupBox> </StackPanel> <StackPanel Grid.Row="3" Grid.Column="0" Margin="5 5 5 5" HorizontalAlignment="Right" Orientation="Horizontal" Height="25" Width="Auto" VerticalAlignment="Center" > <telerik:RadButton x:Name="btSave" IsDefault="True" Width="60" Margin="5 0 5 0" Content="Zapisz" /> <telerik:RadButton x:Name="btOK" IsDefault="True" Width="60" Margin="5 0 5 0" Content="Akceptuj" /> <telerik:RadButton x:Name="btCancel" IsCancel="True" Width="60" Margin="5 0 5 0" Content="Anuluj" /> </StackPanel> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> Please help

    Read the article

  • Problems Allocating Objects of Derived Class Where Base Class has Abstract Virtual Functions

    - by user1743901
    I am trying to get this Zombie/Human agent based simulation running, but I am having problems with these derived classes (Human and Zombie) who have parent class "Creature". I have 3 virtual functions declared in "Creature" and all three of these are re-declared AND DEFINED in both "Human" and "Zombie". But for some reason when I have my program call "new" to allocate memory for objects of type Human or Zombie, it complains about the virtual functions being abstract. Here's the code: definitions.h #ifndef definitions_h #define definitions_h class Creature; class Item; class Coords; class Grid { public: Creature*** cboard; Item*** iboard; int WIDTH; int HEIGHT; Grid(int WIDTHVALUE, int HEIGHTVALUE); void FillGrid(); //initializes grid object with humans and zombies void Refresh(); //calls Creature::Die(),Move(),Attack(),Breed() on every square void UpdateBuffer(char** buffer); bool isEmpty(int startx, int starty, int dir); char CreatureType(int xcoord, int ycoord); char CreatureType(int startx, int starty, int dir); }; class Random { public: int* rptr; void Print(); Random(int MIN, int MAX, int LEN); ~Random(); private: bool alreadyused(int checkthis, int len, int* rptr); bool isClean(); int len; }; class Coords { public: int x; int y; int MaxX; int MaxY; Coords() {x=0; y=0; MaxX=0; MaxY=0;} Coords(int X, int Y, int WIDTH, int HEIGHT) {x=X; y=Y; MaxX=WIDTH; MaxY=HEIGHT; } void MoveRight(); void MoveLeft(); void MoveUp(); void MoveDown(); void MoveUpRight(); void MoveUpLeft(); void MoveDownRight(); void MoveDownLeft(); void MoveDir(int dir); void setx(int X) {x=X;} void sety(int Y) {y=Y;} }; class Creature { public: bool alive; Coords Location; char displayletter; Creature() {Location.x=0; Location.y=0;} Creature(int i, int j) {Location.setx(i); Location.sety(j);} virtual void Attack() =0; virtual void AttackCreature(Grid G, int attackdirection) =0; virtual void Breed() =0; void Die(); void Move(Grid G); int DecideSquare(Grid G); void MoveTo(Grid G, int dir); }; class Human : public Creature { public: bool armed; //if armed, chances of winning fight increased for next fight bool vaccinated; //if vaccinated, no chance of getting infected int bitecount; //if a human is bitten, bite count is set to a random number int breedcount; //if a human goes x steps without combat, will breed if next to a human int starvecount; //if a human does not eat in x steps, will die Human() {displayletter='H';} Human(int i, int j) {displayletter='H';} void Attack(Grid G); void AttackCreature(Grid G, int attackdirection); void Breed(Grid G); //will breed after x steps and next to human int DecideAttack(Grid G); }; class Zombie : public Creature { public: Zombie() {displayletter='Z';} Zombie(int i, int j) {displayletter='Z';} void Attack(Grid G); void AttackCreature(Grid G, int attackdirection); void Breed() {} //does nothing int DecideAttack(Grid G); void AttackCreature(Grid G, int attackdirection); }; class Item { }; #endif definitions.cpp #include <cstdlib> #include "definitions.h" Random::Random(int MIN, int MAX, int LEN) //constructor { len=LEN; rptr=new int[LEN]; //allocate array of given length for (int i=0; i<LEN; i++) { int random; do { random = rand() % (MAX-MIN+1) + MIN; } while (alreadyused(random,LEN,rptr)); rptr[i]=random; } } bool Random::alreadyused(int checkthis, int len, int* rptr) { for (int i=0; i<len; i++) { if (rptr[i]==checkthis) return 1; } return 0; } Random::~Random() { delete rptr; } Grid::Grid(int WIDTHVALUE, int HEIGHTVALUE) { WIDTH = WIDTHVALUE; HEIGHT = HEIGHTVALUE; //builds 2d array of creature pointers cboard = new Creature**[WIDTH]; for(int i=0; i<WIDTH; i++) { cboard[i] = new Creature*[HEIGHT]; } //builds 2d array of item pointers iboard = new Item**[WIDTH]; for (int i=0; i<WIDTH; i++) { iboard[i] = new Item*[HEIGHT]; } } void Grid::FillGrid() { /* For each creature pointer in grid, randomly selects whether to initalize as zombie, human, or empty square. This methodology can be changed to initialize different creature types with different probabilities */ int random; for (int i=0; i<WIDTH; i++) { for (int j=0; j<HEIGHT; j++) { Random X(1,100,1); //create a single random integer from [1,100] at X.rptr random=*(X.rptr); if (random < 20) cboard[i][j] = new Human(i,j); else if (random < 40) cboard[i][j] = new Zombie(i,j); else cboard[i][j] = NULL; } } //at this point every creature pointer should be pointing to either //a zombie, human, or NULL with varying probabilities } void Grid::UpdateBuffer(char** buffer) { for (int i=0; i<WIDTH; i++) { for (int j=0; j<HEIGHT; j++) { if (cboard[i][j]) buffer[i][j]=cboard[i][j]->displayletter; else buffer[i][j]=' '; } } } bool Grid::isEmpty(int startx, int starty, int dir) { Coords StartLocation(startx,starty,WIDTH,HEIGHT); switch(dir) { case 1: StartLocation.MoveUp(); if (cboard[StartLocation.x][StartLocation.y]) return 0; case 2: StartLocation.MoveUpRight(); if (cboard[StartLocation.x][StartLocation.y]) return 0; case 3: StartLocation.MoveRight(); if (cboard[StartLocation.x][StartLocation.y]) return 0; case 4: StartLocation.MoveDownRight(); if (cboard[StartLocation.x][StartLocation.y]) return 0; case 5: StartLocation.MoveDown(); if (cboard[StartLocation.x][StartLocation.y]) return 0; case 6: StartLocation.MoveDownLeft(); if (cboard[StartLocation.x][StartLocation.y]) return 0; case 7: StartLocation.MoveLeft(); if (cboard[StartLocation.x][StartLocation.y]) return 0; case 8: StartLocation.MoveUpLeft(); if (cboard[StartLocation.x][StartLocation.y]) return 0; } return 1; } char Grid::CreatureType(int xcoord, int ycoord) { if (cboard[xcoord][ycoord]) //if there is a creature at location xcoord,ycoord return (cboard[xcoord][ycoord]->displayletter); else //if pointer at location xcoord,ycoord is null, return null char return '\0'; } char Grid::CreatureType(int startx, int starty, int dir) { Coords StartLocation(startx,starty,WIDTH,HEIGHT); switch(dir) { case 1: StartLocation.MoveUp(); if (cboard[StartLocation.x][StartLocation.y]) return (cboard[StartLocation.x][StartLocation.y]->displayletter); case 2: StartLocation.MoveUpRight(); if (cboard[StartLocation.x][StartLocation.y]) return (cboard[StartLocation.x][StartLocation.y]->displayletter); case 3: StartLocation.MoveRight(); if (cboard[StartLocation.x][StartLocation.y]) return (cboard[StartLocation.x][StartLocation.y]->displayletter); case 4: StartLocation.MoveDownRight(); if (cboard[StartLocation.x][StartLocation.y]) return (cboard[StartLocation.x][StartLocation.y]->displayletter); case 5: StartLocation.MoveDown(); if (cboard[StartLocation.x][StartLocation.y]) return (cboard[StartLocation.x][StartLocation.y]->displayletter); case 6: StartLocation.MoveDownLeft(); if (cboard[StartLocation.x][StartLocation.y]) return (cboard[StartLocation.x][StartLocation.y]->displayletter); case 7: StartLocation.MoveLeft(); if (cboard[StartLocation.x][StartLocation.y]) return (cboard[StartLocation.x][StartLocation.y]->displayletter); case 8: StartLocation.MoveUpLeft(); if (cboard[StartLocation.x][StartLocation.y]) return (cboard[StartLocation.x][StartLocation.y]->displayletter); } //if function hasn't returned by now, square being looked at is pointer to null return '\0'; //return null char } void Coords::MoveRight() {(x==MaxX)? (x=0):(x++);} void Coords::MoveLeft() {(x==0)? (x=MaxX):(x--);} void Coords::MoveUp() {(y==0)? (y=MaxY):(y--);} void Coords::MoveDown() {(y==MaxY)? (y=0):(y++);} void Coords::MoveUpRight() {MoveUp(); MoveRight();} void Coords::MoveUpLeft() {MoveUp(); MoveLeft();} void Coords::MoveDownRight() {MoveDown(); MoveRight();} void Coords::MoveDownLeft() {MoveDown(); MoveLeft();} void Coords::MoveDir(int dir) { switch(dir) { case 1: MoveUp(); break; case 2: MoveUpRight(); break; case 3: MoveRight(); break; case 4: MoveDownRight(); break; case 5: MoveDown(); break; case 6: MoveDownLeft(); break; case 7: MoveLeft(); break; case 8: MoveUpLeft(); break; case 0: break; } } void Creature::Move(Grid G) { int movedir=DecideSquare(G); MoveTo(G,movedir); } int Creature::DecideSquare(Grid G) { Random X(1,8,8); //X.rptr now points to 8 unique random integers from [1,8] for (int i=0; i<8; i++) { int dir=X.rptr[i]; if (G.isEmpty(Location.x,Location.y,dir)) return dir; } return 0; } void Creature::MoveTo(Grid G, int dir) { Coords OldLocation=Location; Location.MoveDir(dir); G.cboard[Location.x][Location.y]=this; //point new location to this creature G.cboard[OldLocation.x][OldLocation.y]=NULL; //point old location to NULL } void Creature::Die() { if (!alive) { delete this; this=NULL; } } void Human::Breed(Grid G) { if (!breedcount) { Coords BreedLocation=Location; Random X(1,8,8); for (int i=0; i<8; i++) { BreedLocation.MoveDir(X.rptr[i]); if (!G.cboard[BreedLocation.x][BreedLocation.y]) { G.cboard[BreedLocation.x][BreedLocation.y])=new Human(BreedLocation.x,BreedLocation.y); return; } } } } int Human::DecideAttack(Grid G) { Coords AttackLocation=Location; Random X(1,8,8); int attackdir; for (int i=0; i<8; i++) { attackdir=X.rptr[i]; switch(G.CreatureType(Location.x,Location.y,attackdir)) { case 'H': break; case 'Z': return attackdir; case '\0': break; default: break; } } return 0; //no zombies! } int AttackRoll(int para1, int para2) { //outcome 1: Zombie wins, human dies //outcome 2: Human wins, zombie dies //outcome 3: Human wins, zombie dies, but human is bitten Random X(1,100,1); int roll= *(X.rptr); if (roll < para1) return 1; else if (roll < para2) return 2; else return 3; } void Human::AttackCreature(Grid G, int attackdirection) { Coords AttackLocation=Location; AttackLocation.MoveDir(attackdirection); int para1=33; int para2=33; if (vaccinated) para2=101; //makes attackroll > para 2 impossible, never gets infected if (armed) para1-=16; //reduces chance of zombie winning fight int roll=AttackRoll(para1,para2); //outcome 1: Zombie wins, human dies //outcome 2: Human wins, zombie dies //outcome 3: Human wins, zombie dies, but human is bitten switch(roll) { case 1: alive=0; //human (this) dies return; case 2: G.cboard[AttackLocation.x][AttackLocation.y]->alive=0; return; //zombie dies case 3: G.cboard[AttackLocation.x][AttackLocation.y]->alive=0; //zombie dies Random X(3,7,1); //human is bitten bitecount=*(X.rptr); return; } } int Zombie::DecideAttack(Grid G) { Coords AttackLocation=Location; Random X(1,8,8); int attackdir; for (int i=0; i<8; i++) { attackdir=X.rptr[i]; switch(G.CreatureType(Location.x,Location.y,attackdir)) { case 'H': return attackdir; case 'Z': break; case '\0': break; default: break; } } return 0; //no zombies! } void Zombie::AttackCreature(Grid G, int attackdirection) { int reversedirection; if (attackdirection < 9 && attackdirection>0) { (attackdirection<5)? (reversedirection=attackdirection+4):(reversedirection=attackdirection-4); } else reversedirection=0; //this should never happen //when a zombie attacks a human, the Human::AttackZombie() function is called //in the "reverse" direction, utilizing that function that has already been written Coords ZombieLocation=Location; Coords HumanLocation=Location; HumanLocation.MoveDir(attackdirection); if (G.cboard[HumanLocation.x][HumanLocation.y]) //if there is a human there, which there should be G.cboard[HumanLocation.x][HumanLocation.y]->AttackCreature(G,reversedirection); } void Zombie::Attack(Grid G) { int attackdirection=DecideAttack(G); AttackCreature(G,attackdirection); } main.cpp #include <cstdlib> #include <iostream> #include "definitions.h" using namespace std; int main(int argc, char *argv[]) { Grid G(500,500); system("PAUSE"); return EXIT_SUCCESS; }

    Read the article

  • Does anybody wish to help a poor researcher publish a paper?

    - by Mihai Todor
    I don't know if this is a good place to beg for help, but here it goes: basically, I need to run a secure recommender system simulation (C++ console application) in order to meet tonight's deadline, and the faculty's server grid decided to go offline. I could really use something like 10+ (actually, about 16 would be required to meet the deadline) virtual instances of some Linux that has GMP installed... Ideally, they should all have the same specs, because a part of the simulation will represent performance benchmarks. If my question is inappropriate in any way, I kindly ask the administrators to remove it.

    Read the article

  • Ext-GWT / GXT (Not So) Simple Layout Issue?

    - by Xandel
    Hi all, I have posted this question on the Ext-GWT forums, I am just hoping that someone here might have an answer for me! I am struggling to do something I initially thought was simple but am beginning to believe is impossible... I have got a "layout template" of sorts - simply consisting of a few GWT DockLayoutPanel's within each other and finally ending in LayoutPanels. GWT's LayoutPanel is designed to size the widget (or Composite) that's added to it to its full size and does so perfectly with pure GWT widgets. The idea of my "layout template" is that I don't know the EXACT height and width of the very inner LayoutPanel's because I may set certain panels sizes (of the outer DockLayoutPanels) differently when instantiating this template. All I would like is to add a Grid component to one of the inner most LayoutPanels and have it size itself (height AND width) to fit as normal GWT widgets do (works perfectly with a GWT Label for instance). I am VERY new to GXT (as in I started using it earlier today) and I do realize that GXT builds its Components differently to the way GWT builds its Widgets on the DOM. Is there anyway to achieve the desired result? I have tried adding the grid to a ContentPanel with a Layout of FitLayout, I have tried AnchorLayout, I have tried adding the grid directly... Nothing seems to work... Any advice or even a push in the right direction would be greatly appreciated! Thanks in advance! Xandel

    Read the article

  • Silverlight horizontal stretch and get position issue

    - by David
    I have a Grid (container) wich in turn has several grids(subContainers) arranged by rows. Each one of those "subContainers" has diferent columns and controls. And each of those "subContainers" has the horizontal alignment set to stretch, and it has to stay that way, since the layout this viewer depends on it. I use the "container" to set each control on it's adequate position. So far so good. Now comes my headache... I want to remove the control from the grid and put it in a canvas, at the same exact position, only, the position it returns is as if the control is set to the beggining of the grid and not it's true position. For testing purposes, I've set the "subContainters" horizontal alignment to center and (despite the layout is totally wrong) every control is in it's right position when sent to a canvas, wich it doesn't happen when HA = stretch. Here's the code I'm using to get position: GeneralTransform gt = nc.TransformToVisual(gridZoom); Point offset = gt.Transform(new Point()); So you can understand, for example, my first control should be somewhere like (80, 1090), but the point that I get is (3,3). Can anyone help me? Thanks

    Read the article

  • Orthographic unit translation mismatch on grid (e.g. 64 pixels translates incorrectly)

    - by Justin Van Horne
    I am looking for some insight into a small problem with unit translations on a grid. Setup 512x448 window 64x64 grid gl_Position = projection * world * position; projection is defined by ortho(-w/2.0f, w/2.0f, -h/2.0f, h/2.0f); This is a textbook orthogonal projection function. world is defined by a fixed camera position at (0, 0) position is defined by the sprite's position. Problem In the screenshot below (1:1 scaling) the grid spacing is 64x64 and I am drawing the unit at (64, 64), however the unit draws roughly ~10px in the wrong position. I've tried uniform window dimensions to prevent any distortion on the pixel size, but now I am a bit lost in the proper way in providing a 1:1 pixel-to-world-unit projection. Anyhow, here are some quick images to aide in the problem. I decided to super-impose a bunch of the sprites at what the engine believes is 64x offsets. When this seemed off place, I went about and did the base case of 1 unit. Which seemed to line up as expected. The yellow shows a 1px difference in the movement. Vertices It would appear that the vertices going into the vertex shader are correct. For example, in reference to the first image the data looks like this in the VBO: x y x y ---------------------------- tl | 0.0 24.0 64.0 24.0 bl | 0.0 0.0 -> 64.0 0.0 tr | 16.0 0.0 80.0 0.0 br | 16.0 24.0 80.0 24.0 With that said, all I am left to believe is that I am munging up my actual projection. So, I am looking for any insight into maintaining the 1:1 pixel-to-world-unit projection.

    Read the article

  • How do I simplify a 2D game grid for level management while keeping its by-pixel features?

    - by Eric Thoma
    (I cross-posted this from StackOverflow as this seems to be a more appropriate forum. I've looked around a little here and I did not find an answer, so I hope this is not a recurring question.) This is a question dealing with 2D world design. I am playing around by creating a 2D bird's eye view shooter game, and I am looking to make the game sleek and advanced. I hope to be able to write physics so projectiles have momentum and knock-down properties. I am immediately running into the problem of world design. I need a way to have level files that store everything there is about a game. This is easiest by just having a grid of objects. But there are thin-walls and other objects that don't seem to fit into a traditional cell of a grid. I want to be able to fit all these together so I can streamline level design; so I don't have to put in the exact pixel-specific start and end of a wall. There doesn't seem to be an obvious translation from level file to game without forcing myself into a pacman-life scenario, meaning a scenario where the game feels boxy and discrete. There is a contrast between the smoothly (relatively) moving characters and finite jumps in a grid. I would appreciate an answer that would describe implementation options or point me to resources that do. I would also appreciate references to sites that teach game design. The language I am using is Java (although I would love to use C or C++, but I can never find convenient resources in those languages). Thank you for any answers. Please leave any questions in the space below; I will be able to answer them later tonight (28th Nov).

    Read the article

  • How to Create a Grid for a 2D Game?

    - by SoulBeaver
    So I'm currently writing the engine for my videogame. I've almost integrated Tiled (I think) so I should have a map-creator here soon. My question is, how do I actually make the grid? I'm really confused here. If I create a large map with, say, 20x20 grids the size of 32x32 (screen size 640x640), then what do I do with it? Let's say I have the code for creating a window, and then place a player sprite that I can move with input, that's fine. If I use one map that's as big as the screen, then every pixel on the map is also a pixel on the game screen. The mapping is exact. Now what happens if I have a 2000x2000 map, for example? My character would have to keep moving and move the map around (or rather the camera focused on the player moves). Then I can no longer say that the screen maps exactly to the pixel position of the map. I tried making a Grid class that maps out the screen area to 32x32 tiles, but I'm not sure if that makes any sense. Once the map moves each tile would have to update its information, or something. I'm just really confused here. How do I actually make the tiles and a grid and map them to the data I get from tiled, or that I make myself? Are there any good examples of source code that I could look at?

    Read the article

  • Project Euler #15

    - by Aistina
    Hey everyone, Last night I was trying to solve challenge #15 from Project Euler: Starting in the top left corner of a 2×2 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 20×20 grid? I figured this shouldn't be so hard, so I wrote a basic recursive function: const int gridSize = 20; // call with progress(0, 0) static int progress(int x, int y) { int i = 0; if (x < gridSize) i += progress(x + 1, y); if (y < gridSize) i += progress(x, y + 1); if (x == gridSize && y == gridSize) return 1; return i; } I verified that it worked for a smaller grids such as 2×2 or 3×3, and then set it to run for a 20×20 grid. Imagine my surprise when, 5 hours later, the program was still happily crunching the numbers, and only about 80% done (based on examining its current position/route in the grid). Clearly I'm going about this the wrong way. How would you solve this problem? I'm thinking it should be solved using an equation rather than a method like mine, but that's unfortunately not a strong side of mine. Update: I now have a working version. Basically it caches results obtained before when a n×m block still remains to be traversed. Here is the code along with some comments: // the size of our grid static int gridSize = 20; // the amount of paths available for a "NxM" block, e.g. "2x2" => 4 static Dictionary<string, long> pathsByBlock = new Dictionary<string, long>(); // calculate the surface of the block to the finish line static long calcsurface(long x, long y) { return (gridSize - x) * (gridSize - y); } // call using progress (0, 0) static long progress(long x, long y) { // first calculate the surface of the block remaining long surface = calcsurface(x, y); long i = 0; // zero surface means only 1 path remains // (we either go only right, or only down) if (surface == 0) return 1; // create a textual representation of the remaining // block, for use in the dictionary string block = (gridSize - x) + "x" + (gridSize - y); // if a same block has not been processed before if (!pathsByBlock.ContainsKey(block)) { // calculate it in the right direction if (x < gridSize) i += progress(x + 1, y); // and in the down direction if (y < gridSize) i += progress(x, y + 1); // and cache the result! pathsByBlock[block] = i; } // self-explanatory :) return pathsByBlock[block]; } Calling it 20 times, for grids with size 1×1 through 20×20 produces the following output: There are 2 paths in a 1 sized grid 0,0110006 seconds There are 6 paths in a 2 sized grid 0,0030002 seconds There are 20 paths in a 3 sized grid 0 seconds There are 70 paths in a 4 sized grid 0 seconds There are 252 paths in a 5 sized grid 0 seconds There are 924 paths in a 6 sized grid 0 seconds There are 3432 paths in a 7 sized grid 0 seconds There are 12870 paths in a 8 sized grid 0,001 seconds There are 48620 paths in a 9 sized grid 0,0010001 seconds There are 184756 paths in a 10 sized grid 0,001 seconds There are 705432 paths in a 11 sized grid 0 seconds There are 2704156 paths in a 12 sized grid 0 seconds There are 10400600 paths in a 13 sized grid 0,001 seconds There are 40116600 paths in a 14 sized grid 0 seconds There are 155117520 paths in a 15 sized grid 0 seconds There are 601080390 paths in a 16 sized grid 0,0010001 seconds There are 2333606220 paths in a 17 sized grid 0,001 seconds There are 9075135300 paths in a 18 sized grid 0,001 seconds There are 35345263800 paths in a 19 sized grid 0,001 seconds There are 137846528820 paths in a 20 sized grid 0,0010001 seconds 0,0390022 seconds in total I'm accepting danben's answer, because his helped me find this solution the most. But upvotes also to Tim Goodman and Agos :) Bonus update: After reading Eric Lippert's answer, I took another look and rewrote it somewhat. The basic idea is still the same but the caching part has been taken out and put in a separate function, like in Eric's example. The result is some much more elegant looking code. // the size of our grid const int gridSize = 20; // magic. static Func<A1, A2, R> Memoize<A1, A2, R>(this Func<A1, A2, R> f) { // Return a function which is f with caching. var dictionary = new Dictionary<string, R>(); return (A1 a1, A2 a2) => { R r; string key = a1 + "x" + a2; if (!dictionary.TryGetValue(key, out r)) { // not in cache yet r = f(a1, a2); dictionary.Add(key, r); } return r; }; } // calculate the surface of the block to the finish line static long calcsurface(long x, long y) { return (gridSize - x) * (gridSize - y); } // call using progress (0, 0) static Func<long, long, long> progress = ((Func<long, long, long>)((long x, long y) => { // first calculate the surface of the block remaining long surface = calcsurface(x, y); long i = 0; // zero surface means only 1 path remains // (we either go only right, or only down) if (surface == 0) return 1; // calculate it in the right direction if (x < gridSize) i += progress(x + 1, y); // and in the down direction if (y < gridSize) i += progress(x, y + 1); // self-explanatory :) return i; })).Memoize(); By the way, I couldn't think of a better way to use the two arguments as a key for the dictionary. I googled around a bit, and it seems this is a common solution. Oh well.

    Read the article

  • MVC2 MSchart with detail grid

    - by ben
    Hello, I need the capability to display a chart, click on a region and display the details in a jqgrid on the same page. I tried using a pie Chart and I can't seem to capture or create a click event for the chart. The data points contain a .url property which I can redirect to a different page but I need to display details on the same page like a master-detail page.

    Read the article

  • how get value from smartgwt Custom FilterEditorType ?

    - by Ehsan Khodarahmi
    Hi I've developed a custom widget (a persian calendar consist of a base textbox & image widget on a gwt grid which look likes smartgwt calendar) & putted it in a CanvasItem because i want to add it as a filter editor for a listGrid : ListGridField regDateTimeField = new ListGridField("regDateTime", ????? ? ????", 120"); regDateTimeField.setFilterEditorType(new PersianCalendarItem()); now list grid displays it successfully, but when i click on filter button, nothing happend even when it value changes. I think i have to override some canvas item methods to return internal textbox value, but i don't know how should i do this ???

    Read the article

  • Find Control in Grid

    - by Eric
    I have a RadGrid with radio buttons on the inside of a FormTemplate. I want hide the panels below or show the panels below on checkchanged of the radio button. However, my issue is that i don't know how to access the panels oncheckchanged. Any help would be appreciate. Thanks in advance. protected void RadioButtonCompany_CheckChanged(object sender, EventArgs e) { RadioButton RadioButtonCompany = (RadioButton)sender; Panel pnlPerson = (Panel)RadGridInjuries.Items[1].FindControl("pnlPerson"); Panel pnlcomp = (Panel)RadGridInjuries.MasterTableView.FindControl("pnlComp"); if (RadioButtonCompany.Checked) { pnlPerson.Visible = false; pnlcomp.Visible = true; } else { pnlPerson.Visible = true; pnlcomp.Visible = false; } } <telerik:RadGrid ID="RadGridInjuries" DataSourceID="DSource"> <GroupingSettings CaseSensitive="false" /> <SelectedItemStyle CssClass="Cursor" /> <ItemStyle CssClass="Cursor" /> <MasterTableView TableLayout="Auto" CssClass="Cursor" CanRetrieveAllData="true" CommandItemDisplay="Top" ShowHeadersWhenNoRecords="false" GridLines="Both" runat="server"> <ItemStyle CssClass="Cursor" /> <EditFormSettings EditFormType="Template" > <FormTemplate> <table id="Table2" width="100%" border="0" rules="none" style="border-collapse: collapse;background:#F0F0F0"> <tr> <td style="font-size: medium;color:Blue"> <b>Provider Details Information</b></td> </tr> <tr><td><br /></td></tr> <tr> <td> <asp:RadioButton ID="RadioButtonCompany" OnCheckedChanged="RadioButtonCompany_CheckChanged" runat="server" Text="Company" GroupName="Type" AutoPostBack="true" /> <asp:RadioButton ID="RadioButtonPerson" runat="server" Text="Person" GroupName="Type" AutoPostBack="true" /> </td> </tr> <tr><td><br /></td></tr> <tr> <td align="center"> <asp:Panel ID="pnlPerson" runat="server" Visible="false"> //stuff in here <asp:/Panel> <asp:Panel ID="pnlCompany" runat="server" Visible="false"> //stuff in here <asp:/Panel> </FormTemplate> </EditFormSettings> </MasterTableView> <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="false"> <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" /> <ClientEvents /> </ClientSettings> </telerik:RadGrid>

    Read the article

  • constructing paramater query SQL - LIKE % in .cs and in grid view

    - by Indranil Mutsuddy
    Hello friends, I am trying to implement admin login and operators(india,australia,america) login, now operator id starts with 'IND123' 'AUS123' and 'AM123' when operator india logs in he can see the details of only members have id 'IND%', the same applies for an australian and american users and when admin logs in he can see details of members with id 'IND%' or 'AUS%' or 'AM%' i have a table which defines the role i.e admin or operator and their prefix(IND,AUS respectively) In loginpage i created a session for Role and prefix PREFIX = myReader["Prefix"].ToString(); Session["LoginRole"] = myReader["Role"].ToString(); Session["LoginPrefix"] = String.Concat(PREFIX + "%"); works fine In main page(after login) i have to count the number of member so i wrote string prefix = Session["LoginPrefix"].ToString(); string role = Session["LoginRole"].ToString(); if (role.Equals("ADMIN")) StrMemberId = "select count(*) from MemberList"; else StrMemberId = "select count(*) from MemberList where MemberID like '"+prefix+"'"; thatworks fine too Problem: 1. i want to constructor parameter something like StrMemberId = "select count(*) from MemberList where MemberID like '@prefix+'"; myCommd.Parameters.AddWithValue("@prefix", prefix); Which is not working 2 Displaying the members in gridview i need to give condition (something like if (role.Equals("ADMIN")) show all members else show member depending on the operator prefix)the list of members in operator mode and admin mode. - where to put the condition in gridview how to apply these please suggest something Regards Indranil

    Read the article

  • Progress bar in data grid view

    - by Pat
    Is there a way to have a progress bar in a cell in a DataGridView? At design time, you can add a TextBox, Button, Image, Link, ComboBox, or CheckBox, but not a ProgessBar. Is there a better control in WPF that will allow this?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >