|
i want to update a gridview which contain textboxes and a dropdownlist. i use this code to update a dropdownlist in gridview by running this code it show an error does not contain definition for row index
protected void GridView1_RowUpdating(object sender, GridViewUpdatedEventArgs e)
{
string struName =(DropDownList)(GridView1.Rows[e.RowIndex].Cells[4].FindControl("Drop")).SelectedValue;
e.NewValues["Active"] = struName;
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="TransactionTypeID" DataSourceID="SqlDataSource3"
style="top: 345px; left: 390px; position: absolute; height: 133px; width: 187px; z-index: 1"
onrowupdated="GridView1_RowUpdating">
<Columns>
<asp:BoundField DataField="TransactionTypeID" HeaderText="TransactionTypeID"
ReadOnly="True" SortExpression="TransactionTypeID" />
<asp:BoundField DataField="Transaction" HeaderText="Transaction"
SortExpression="Transaction" />
<asp:BoundField DataField="Description" HeaderText="Description"
SortExpression="Description" />
<asp:BoundField DataField="Category" HeaderText="Category"
SortExpression="Category" />
<asp:TemplateField HeaderText="User Name">
<ItemTemplate>
<asp:Label ID="lbl1" runat="server" Text='<%# Bind("Active")%>' />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="Drop" runat="server" AppendDataBoundItems="true"
AutoPostBack="True" SelectedValue='<%# Bind("Active")%>'>
<asp:ListItem Value="Yes"></asp:ListItem>
<asp:ListItem Value ="No"></asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
modified on Tuesday, August 4, 2009 1:59 AM
|
|
|
|
|
You post looks like Garbage value . Please post it with proper formatting.
Thanks
|
|
|
|
|
i rearrange the code plz now check and help
|
|
|
|
|
i have to position controls on web page dynamically using drag drop. i do it with the use of ajax dragdrop control. but there is a problem when page is posted back all the controls are repositioned to top left corner(0,0 position). is there any way to maintain position of controls on postback or set postion of controls like we do in windows .net. please reply.
thanks and regards
|
|
|
|
|
You have to maintain the position during partial postback. For that we need to use Sys.WebForms.PageRequestManager Class . It has two eevents beginRequest and endRequest . During those event you have to trap the dragged position and then set the position again.
Here, I have done a similar application with gridview, for maintaining scroll position during partial postback.
Maintain GridView Scroll Position and Header Inside Update Panel[^]
Hope this will help you
|
|
|
|
|
how to make property classes
|
|
|
|
|
Sample Class with Property
public class Student
{
Student()
{
}
Private int roll;
Public int Roll
Get
{
return roll;
}
set
{
roll=value;
}
}
Access Property of Class
// Create Object of Student Class
Student S=new Student();
//Access Property of Student
S.Roll=1;
|
|
|
|
|
|
how to put user name and password on master page using classes
|
|
|
|
|
rajni_nanu wrote: how to put user name and password on master page using classes
Your question is not clear. What do you mean by that? Do you want to accept user id and password in master page ?
|
|
|
|
|
|
place the login control on the master page, then you can put
your username and password there.
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
how can i do coding in that
|
|
|
|
|
Hi. I have to show a record in vertical format. The data is in database. I have to fetch the record and display the record vertically in the form. Which tool i can use so that i can display the record in more effective way. Please help me.
|
|
|
|
|
How about a FormView or DetailsView ?
|
|
|
|
|
What is the property to set, if i don't want header text. Althouth i deleted the headertext property. It still showing that column with the empty.
|
|
|
|
|
Try HeaderRow.Visible .
Have you looked at the MSDN documentation[^] for either of those controls?
|
|
|
|
|
Along with the control suggested by Mike, you can have a look into Repeater Control Or Use XSLT to render data on page
|
|
|
|
|
Hi,
How to fill the dataset rows with serial number?
Thankyou
YPKI
|
|
|
|
|
Use AutoIncrement, AutoIncrementSeed, and AutoIncrementStep properties for a DataColumn with type Int16, Int32 and Int64.
DataColumn column = new DataColumn();
column.DataType = System.Type.GetType("System.Int32");
column.AutoIncrement = true;
column.AutoIncrementSeed = 1000;
column.AutoIncrementStep = 10;
DataTable table = new DataTable("table");
table.Columns.Add(column);
|
|
|
|
|
Serial number is for presentation purpose and I'd suggest you not to add it on your data structure (DataSet in your case). Handle it when you display the value. For example, if you are binding it to a GridView , you can do something like,
<%#Container.DataItemIndex+1 %>
|
|
|
|
|
Hello.
I wasn't able to find much help on StructureMap's website, so I'm hoping perhaps I can find some help here. I think I have just a small bug in my StructureMap code, but I'm not sure where....
I'm trying to install structuremap into my 1st website but I'm unable to successfully reference classes set within structuremap. I have 2 projects: a c# class library (MyCompany.MySite.Core) & my website (MyCompany.MySite.Web). My structuremap.config contains a reference to a class I created called "IRedirector". The config file looks like the following:
<?xml version="1.0" encoding="utf-8" ?>
<StructureMap>
<Assembly Name="MyCompany.MySite.Core" />
<Assembly Name="MyCompany.MySite.Web" />
<PluginFamily Assembly="MyCompany.MySite.Core" Type="MyCompany.MySite.Core.Impl.IRedirector" DefaultKey="Default"/>
</StructureMap>
My IRedirector class looks like this:
namespace MyCompany.MySite.Core.Impl
{
[PluginFamily("Default")]
public interface IRedirector
{
void GoToHomePage();
void GoToErrorPage();
}
}
Now, as I understood it, I should be able to reference this class in my website by referencing MyCompany.MySite.Core, but I get an error. Instead, my website wants MyCompany.MySite.Core.Impl.
For example, the following is incorrect:
using MyCompany.MySite.Core;
namespace MyCompany.MySite.Web
{
public class Global : System.Web.HttpApplication
{
protected void Application_Error(object sender, EventArgs e)
{
IRedirector redir = ObjectFactory.GetInstance<IRedirector>();
redir.GoToErrorPage();
}
}
}
In that example, the line beginning with "IRedirector" will throw an error, unless I add a reference to "using MyCompany.MySite.Core.Impl;"
I want to reference it using only "MyCompany.MySite.Core". Any idea what I'm doing wrong?
Thanks.
|
|
|
|
|
Goalie35 wrote: I have 2 projects: a c# class library (MyCompany.MySite.Core) & my website (MyCompany.MySite.Web).
Goalie35 wrote: my website wants MyCompany.MySite.Core.Impl.
Goalie35 wrote: unless I add a reference to "using MyCompany.MySite.Core.Impl;"
All are contradictory statements. You said you have only two projects, so where does the MyCompany.MySite.Core.Impl came from? If MyCompany.MySite.Core.Impl is just a name space inside project MyCompany.MySite.Core , you need to add proper namespace includes at the place where you use it.
using MyCompany.MySite.Core;
using MyCompany.MySite.Core.Impl;
namespace MyCompany.MySite.Web
{
public class Global : System.Web.HttpApplication
{
}
}
|
|
|
|
|
Hi Navaneeth. Thanks for your reply.
I'm actually following along in a book I'm reading (ASP.NET 3.5: Social Networking) and in this book, his examples say to declare the namespaces in this fashion along with using StructureMap. So that's where I'm stuck. I've visited a few sites offering tips on StructureMap & they seem to have similar examples but unfortunately, mine doesn't work.
The MyCompany.MySite.Core.Impl namespace is a subdirectory called "Impl" within my Core project (again, an example within the book).
Hope that makes more sense
Thanks again.
|
|
|
|
|
Goalie35 wrote: The MyCompany.MySite.Core.Impl namespace is a subdirectory called "Impl" within my Core projec
In such case, you only need to refer the core dll. Just use the name space as I said in my earlier post. Is this a huge application? IMO, using dependency injection frameworks like structure map for simple applications will introduce unnecessary complexity to the application.
|
|
|
|