|
You can still show a gridview if it is empty.
http://www.google.com/search?hl=en&client=opera&rls=en&hs=hiy&q=show+empty+gridview&btnG=Search
There quite a few examples here, for how to show a gridview when there no data.
|
|
|
|
|
For adding textboxes dynamicaly into a form you can either add textbox controls to a form directly or to a placeholder control inside the form.For retriving values correctly i suggest you to place controls inside a placeholder.
You want to create 3 Textboxes in each link button click.Here what i had done is I placed a dropdownlist with items 1,2,3 ..etc.According to the selected item value of the dropdownlist that much set of 3 Textboxes is generated.
For that first I place a DropDownList1,PlaceHolder1 and Button1 in the form.
My code follows
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < Convert.ToInt16(DropDownList1.SelectedItem.Text); i++)
{
PlaceHolder p2 = new PlaceHolder();
p2.ID = "p2" + i;
PlaceHolder1.Controls.Add(p2);
for (int j = 0; j < 3; j++)
{
TextBox tb = new TextBox();
tb.ID = "TextBoxg"+i + j;
p2.Controls.Add(tb);
RequiredFieldValidator f1 = new RequiredFieldValidator();
f1.ControlToValidate = "TextBoxg" + i+j; ;
f1.ErrorMessage ="*";
p2.Controls.Add(f1);
p2.Controls.Add(InsertBreaks(1));
}
p2.Controls.Add(InsertLineBreaks(2));
}
}
private static Label InsertBreaks(int breaks)
{
Label lblBreak = new Label();
for (int i = 0; i < breaks; i++)
{
lblBreak.Text += " ";
}
return lblBreak;
}
private static Label InsertLineBreaks(int breaks)
{
Label lblLineBreak = new Label();
for (int i = 0; i < breaks; i++)
{
lblLineBreak.Text += " ";
}
return lblLineBreak;
}
protected void Button1_Click(object sender, EventArgs e)
{
string[] data = new string[3];
foreach (Control c in PlaceHolder1.Controls)
{
int yu = 0;
foreach (Control c23 in c.Controls)
{
if (c23.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
{
data[yu] = ((TextBox)c23).Text;
yu = yu + 1;
}
}
//data[0], data[1], data[2] will contain the datas of each row.
//Here you can give your insert command to the database
}
}
}
Explanation:Here inside PalceHolder1 I dynamically created a placeholder with 3 Text Boxes for each row.According to the selected value of the dropdownlist, number of placeholders are dynamically created inside PlaceHolder1.For each TextBoxes I dynamically created required field validators also.If you dont want validator you can remove it and use.
Hope this code will clear your doubts
|
|
|
|
|
i want create templatefield in gridview
i wrote this code:
RadioButton rb = new RadioButton();
TemplateField select = new TemplateField();
select.ItemTemplate = (ITemplate)rb.TemplateControl;
select.HeaderText = "SELECT";
timeGrid.Columns.Add(select);
but dont show any radiobutton in each row. how should i do???? plz.
|
|
|
|
|
|
Did you not pay attention to the answer given to you before?
|
|
|
|
|
i have 2 button and a custom control,which contains a grid view, on page.
i set datasource of gridview; sequentially rowdatabound and rowcreated events are raised. After the events are raised in custom control i need to hide buttons on page how could i do ?
Note : button are in a server side div control. So i can set the display:none with javascript in control.
|
|
|
|
|
Hi,
I have a problem when integrating payment process. I send a (url+query string of my site) to payment site in form of hidden field, when i do payment, payment site gives me a link in which href is same as url given by me.
Now when i click the url i actually update the payment details in my system.
Now i want to confirm that this url is coming from payment site not from my site as any one can update the details by hitting the url.
Please help me to get the address of site who send me the url.
Regards,
Anup
|
|
|
|
|
|
Thanks for reply..
I am using the same but it gives me the url of current page instead of page from where url is opened up.
Have you any other trick??
Thanks
|
|
|
|
|
Hi,
I want to change value of textbox2 while entering value in textbox1.
Is it possible?
Thanks
|
|
|
|
|
sjs4u wrote: Is it possible?
Yes. Hook onkeypressed or changed JS events. Get the current text from textbox1 and set to textbox2.
|
|
|
|
|
R u really a programmer?
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
|
cos I cant believe, an ASP.NET programmer dont know what u have asked
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
My question was simple.
Though I know the JS and the above solution given by navneet.
I was thinking, if any other solution was there or not instead of writing JS.
|
|
|
|
|
U can use events running on server also, but it'll cause postback n ur page will be refreshed on every change. so the best solution is using Javascript use "tb1.onlostfocus" event for best result if u want to change tb2 after completing writting in tb1. otherwise use tb1.onkeyup" for changing tb2 for every character pressed in tb1.
got it buddy?
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
|
Is it possible? And if it is, then how? (InProc session with cookieless="false")
modified on Tuesday, August 5, 2008 3:38 AM
|
|
|
|
|
Sessions are not shared. Why do you want to do that ?
|
|
|
|
|
Sessions are unique to the user and their browser
|
|
|
|
|
hi every one,
I developed one web application from there i calling one table from database
that time i retrieving all the info from table but images are not displaying to my page.I cleared mention the path of image file in varchar field.why i am not getting?
|
|
|
|
|
Hi,
I think you should refer to the relative path, and not the absolute path as to show the image in the web page.
Here is just a suggestion. When you are saving the image, save only the image name in the database, and get the relative path and construct the path and display.
Hope it helps,
Thx,
Gayani
|
|
|
|
|
hiiiii......
The images you stored in the database have to be converted into bytes while retreiving, for this you hav to store image path,it's length n it's type...
you will also need a handler file..
try it....i hope it will help you, i have done this before!!!!
|
|
|
|
|
In my form there are other controls .I want to print only report viewer on button click .
I use window.print() on that button click but it print all the controls and master page tree view etc.That are displayed in that page.How can i print reportviewer on button click
|
|
|
|
|
window.print tells browser to print the whole page. It can't print the required area alone. Normal method is to put the things required on a separate page and print that page.
|
|
|
|